Coursera

Create a cluster

Create a cluster with 3 nodes, machine type e2-small

gcloud container clusters create bootcamp \
  --machine-type e2-small \
  --num-nodes 3 \
  --scopes "https://www.googleapis.com/auth/projecthosting,storage-rw"

With prometheus:

gcloud beta container clusters create gmp-cluster \
  --num-nodes=1 \
  --zone us-west1-c \
  --enable-managed-prometheus

Create a namespace:

kubetcl create ns name

Create a deployment with deployments/auth.yaml

kubetcl create -f deployments/auth.yaml

Deploy to a namespace:

kubetcl -n name apply -f <config.yaml>

Create & expose frontend i.e. create a ConfigMap when creating

kubectl create secret generic tls-certs --from-file tls/
kubectl create configmap nginx-frontend-conf --from-file=nginx/frontend.conf
kubectl create -f deployments/frontend.yaml
kubectl create -f services/frontend.yaml

Get external IP of the frontend:

kubectl get services frontend

Scaling

Scale deployment hello to 5 pods

kubectl scale deployment hello --replicas=5

Rolling update

Update deployment hello:

kubectl edit deployment hello

Update will begin after save and exit. If during rollout something happens and you want to pause it:

kubectl rollout pause deployment/hello

To resume:

kubetcl rollout resume deployment/hello

If you want to rollback:

kubectl rollout undo deployment/hello

Running prometheus

./prometheus \
  --config.file=documentation/examples/prometheus.yml \
  --export.label.project-id=$PROJECT_ID \
  --export.label.location=$ZONE