Deploying to a Google Kubernetes Engine Cluster

30 minutes
  • 9 Learning Objectives

About this Hands-on Lab

The strength and flexibility of Kubernetes is built around the concept of containerized applications, which are deployed differently from non-containerized apps. In this hands-on lab, you’ll complete all the steps from creating a Kubernetes cluster to confirming the deployed application, including creating the Docker image of your application, pushing that image to Container Registry, deploying the workload, and then configuring a load balancer to expose it.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the Kubernetes Engine cluster.
  1. From the Kubernetes Engine Clusters page, click Create cluster.
  2. Configure the new cluster:
    • Name the cluster
    • Change the number of nodes to 4
    • Under Nodes, Machine Configuration, General-Purpose, change the Series to "N1" and the Machine type to "n1-standard-1".
    • Leave all other settings at their default
  3. Click Create.
Get the files.
  1. Clone the GitHub repository:
    git clone
  2. Change directory with the following command:
    cd content-gcpro-developer/kubernetes-engine-lab
Configure the `config.yaml` file.
  1. In the Cloud Shell Editor, open the config.yaml file.
  2. On line 32, replace [PROJECT_ID] with your project ID.
  3. Choose the file and then select Save.
Build the containerized Docker image.

In the Cloud Shell, execute the following command:

docker build -t la-container-image .
Push the containerized app into the Container Registry.
  1. In the Cloud Shell, configure Docker to use the gcloud command:
    gcloud auth configure-docker
  2. Tag the image with the registry name:
    docker tag la-container-image[PROJECT_ID]/la-container-image:v1
  3. Push the image to the Container Registry:
    docker push[PROJECT_ID]/la-container-image:v1
Confirm the operation.
  1. Navigate to Container Registry Images.
  2. Confirm the existence of la-container-image.
Deploy the workload.
  1. Navigate to Kubernetes Engine > Workloads.
  2. Click Deploy.
  3. Choose the existing container image.
  4. Click Deploy.
Increase the number of pods.
  1. Navigate to the YAML tab.
  2. Click Edit.
  3. Change the number of replicas to 4.
  4. Click Save.
  5. Confirm the operation.
Expose the deployment.
  1. From the Deployment Details page, click Expose.
  2. Set the Service type to Load balancer.
  3. Click Expose.
  4. Confirm by clicking the External IP link.

Additional Resources

You’ve been given the job of testing the Google Kubernetes Engine for your organization and have been asked to deploy a sample application to a new cluster of four nodes. You’ll need to containerize the app using Docker and then store the Docker image in Google Container Registry. Once that task is complete, you’ll have to deploy the workload, adjust the number of pods, and then expose the workload by configuring a load balancer.

To accomplish this task, you’ll need to complete the following steps:

  1. Create the Kubernetes Engine cluster.
  2. Containerize the app with Docker.
  3. Store the Docker image in the Container Registry.
  4. Deploy the workload.
  5. Increase the number of pods (replicas) running.
  6. Expose the workload with a load balancer.

Note: When creating the cluster, make sure to use "n1-standard-1" instances.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?