Skip to content

Google Kubernetes Engine (GKE)

  • Skaffold must be configured to send a build requests to 'Google Cloud Build'

  • Create a new project on Google Cloud Console

  • Go to Kubernetes Engine -> Clusters
  • Create Cluster
  • Cluster basics

  • name: Name of the cluster

  • zone: southamerica-east1-a
  • version: at least 1.15

  • Node pools:

  • number of nodes: 3

  • Nodes/Machine type: g1-small (Series N1)

  • Install GCloud SDK

# Add the Cloud SDK distribution URI as a package source
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

# Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk
  1. Add the new context
# Login to GCloud SDK
gcloud auth login

# Initialize GCLoud
gcloud init
  # Re-initialize the previous configuration
  # Choose e-mail account
  # Select the project
  # Set default region (y)
  # southamerica-east1-a

# Add a context of C
gcloud container clusters get-credentials "cluster-name"

# List all contexts (clusters)
kubectl config get-contexts

# Select a context
kubectl config use-context "context-name"
  1. Enable GCloud Build

  2. Enable GCloud Build on the console: Tools/Cloud Build

  3. Change skaffold: googleCloudBuild: projectId: ticketing-283819
  4. Change the image name to gcloud standards: gcr.io/ticketing-283819/auth

  5. Create a Load Balancer

  6. Go to official documentation of Nginx Ingress Controller

# Initialize as cluster-admin
kubectl create clusterrolebinding cluster-admin-binding \
  --clusterrole cluster-admin \
  --user $(gcloud config get-value account)
# Install Nginx Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.34.1/deploy/static/provider/cloud/deploy.yaml
  • Go to Networking / Network Services/ Load Balancing (a LB was automatically created)
  • Get the IP address of the load balancer (35.198.25.168)
  • Add the IP to the /etc/hosts: 35.198.25.168 ticketing.dev

  • Run the skaffold

# Authenticate
gcloud auth application-default login

# Run
skaffold dev