Skip to content

Latest commit

 

History

History
106 lines (74 loc) · 1.81 KB

File metadata and controls

106 lines (74 loc) · 1.81 KB

GSP053 - Managing Deployments Using Kubernetes Engine

Setup

  1. Set zone

    gcloud config set compute/zone us-central1-f
  2. sample code

    gsutil -m cp -r gs://spls/gsp053/orchestrate-with-kubernetes .
    cd orchestrate-with-kubernetes/kubernetes
  3. Create cluster

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

Task 1. Learn about the deployment object

  1. Learn command

    kubectl explain deployment
    kubectl explain deployment --recursive
    kubectl explain deployment.metadata.name

Task 2. Create a deployment

  1. Ubah konfigurasi

    nano vi deployments/auth.yaml
  2. Create Deployment

    kubectl create -f deployments/auth.yaml
  3. Verify / View

    kubectl get deployments
    kubectl get replicasets
    kubectl get pods
  4. Buat service

    kubectl create -f services/auth.yaml
  5. Deploy and expose

    kubectl create -f deployments/hello.yaml
    kubectl create -f services/hello.yaml
  6. More

    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
  7. Scale

kubectl explain deployment.spec.replicas
kubectl scale deployment hello --replicas=5
kubectl get pods | grep hello- | wc -l
kubectl scale deployment hello --replicas=3

Task 3. Rolling update

  1. Update deployment

    kubectl edit deployment hello

Task 4. Canary deployments

Task 5. Blue-green deployments