GSP-304 : Build and Deploy a Docker Image to a Kubernetes Cluster

GSP-304 : Build and Deploy a Docker Image to a Kubernetes Cluster

Overview

Built Docker image with tag V1

1gsutil cp gs://sureskills-ql/challenge-labs/ch04-kubernetes-app-deployment/echo-web.tar.gz .

OR

1gsutil cp gs://$DEVSHELL_PROJECT_ID/echo-web.tar.gz .

Extract downloaded zip

1tar -xvf echo-web.tar.gz
2
3gcloud builds submit --tag gcr.io/$DEVSHELL_PROJECT_ID/echo-app:v1 .

Create Kubernetes cluster

1gcloud container clusters create echo-cluster --num-nodes 2 --zone us-central1-a --machine-type n1-standard-2

Deploy application to Kubernetes cluster

1kubectl create deployment echo-web --image=gcr.io/qwiklabs-resources/echo-app:v1

Expose app to allow external access

1kubectl expose deployment echo-web --type=LoadBalancer --port=80 --target-port=8000

Extract Kubernetes services

1kubectl get svc

Congratulations, you're all done with the lab 😄