Scale Out and Update a Containerized Application on a Kubernetes Cluster

This article will go through the lab to Scale-Out and Update a Containerized Application on a Kubernetes Cluster. This lab is similar to Build and Deploy a Docker Image to a Kubernetes Cluster.

The challenge contains 4 required tasks.

  1. Check that there is a tagged image in gcr.io for echo-app:v2.
  2. Echo-app:v2 is running on the Kubernetes cluster.
  3. The Kubernetes cluster deployment reports 2 replicas.
  4. The application must respond to web requests with V2.0.0.

Challenge Scenario

Before you get started, open the navigation menu and select Cloud Storage. The last steps in the Deployment Manager script used to set up your environment create a bucket.

Refresh the Storage browser until you see your bucket. You can move on once your Console resembles the following:

Check to make sure your GKE cluster has been created before continuing. Open the navigation menu and select Kubernetes Engine > Clusters.

Continue when you see a green checkmark next to echo-cluster:

To deploy your first version of the application, run the following commands in Cloud Shell to get up and running:

gcloud container clusters get-credentials echo-cluster --zone=us-central1-a
kubectl create deployment echo-web --image=gcr.io/qwiklabs-resources/echo-app:v1
kubectl expose deployment echo-web --type=LoadBalancer --port 80 --target-port 8000

1.Check that there is a tagged image in gcr.io for echo-app:v2

  • Go to Cloud shell and write commands.
gsutil cp gs://sureskills-ql/challenge-labs/ch04-kubernetes-app-deployment/echo-web.tar.gz . tar -xvf echo-web.tar.gz
  • In the GCP Console go to Cloud Shell copy and paste the command.
  • It will tag image in gcr.io for echo-app:v2
gcloud builds submit --tag gcr.io/$DEVSHELL_PROJECT_ID/echo-app:v2 .
  • In the GCP Console go to Cloud Shell copy and paste the command.
  • Configuration as follow:

Cluster Name: echo-cluster

Zone: us-central1-a

gcloud container clusters get-credentials echo-cluster --zone us-central1-a 

2. Echo-app:v2 is running on the Kubernetes cluster

  • It will create an application image with a v1 tag that has been pushed to the gcr.io repository
kubectl create deployment echo-web --image=gcr.io/qwiklabs-resources/echo-app:v1 kubectl expose deployment echo-web --type=LoadBalancer --port 80 --target-port 8000

3.The Kubernetes cluster deployment reports 2 replicas.

 kubectl scale deploy echo-web --replicas=2

4.The application must respond to web requests with V2.0.0

kubectl edit deploy echo-web
  • Change the image version ‘v1’ to ‘v2’ by pressing “i”.
  • Save by esc -> Esc → “:wq”.

Congratulations! Done with the challenge lab.

LinkedIn: https://www.linkedin.com/in/mayank-chourasia-38421a134/

Twitter: https://twitter.com/ChourasiaMayank.

Thank you Stay Safe, Stay healthy.

Stay tuned till the next blog.

Google Developers Google Cloud Qwiklabs KUBERNETS INC

I am Google Cloud Certified Associate Cloud Engineer and MS Azure Certifed. I have been working on different fields including Cloud Computing , Sap ABAP.