Getting Started with Kubernetes Engine

90m access · 60m completion
Connection Details


Getting Started with Kubernetes Engine


In this lab you create a Kubernetes Engine cluster containing several containers, each containing a web server. You place a load balancer in front of the cluster and view its contents.


In this lab, you learn how to perform the following tasks:

Sign in to the Google Cloud Platform (GCP) Console

  1. Make sure that you have access to a standard web browser. The Google Chrome browser is recommended.
  2. In Qwiklabs's top frame, check the lab's access time. Plan your schedule so that you have time to complete the lab. Once you start the lab, you will not be able to pause and return later. (Each time you start a lab, you begin at step 1.)
  3. When you are ready, click Start Lab.
  4. Qwiklabs creates the resources required for you to perform the lab. It allocates a username and password for you, and creates a Google Cloud Platform project to contain your work.
  1. Did you originally sign in to Qwiklabs in an incognito browser window? If so, click the Open Google Console button to open the console in a new tab. Otherwise, open an incognito browser window now and navigate to
  2. Sign in to the Google Cloud Platform Console by using the username and password provided to you by Qwiklabs. Do not use your personal Gmail or GCP account to sign in to the Cloud Platform Console.
  1. If you are asked to enter account recovery details, skip this step.
  2. If you are asked to accept the Google Cloud Platform terms of service, accept them.
  3. Once in the Google Cloud Platform Console, compare the GCP project ID shown in the top bar of the console to the project ID Qwiklabs assigned you. If they differ, click on the project ID shown in the console and select instead the project ID Qwiklabs assigned you.
  4. Look at the Connection Details heading of the Qwiklabs window. If you see a Region and Zone specified at the bottom of this section, you should use this GCP region and zone unless directed otherwise.

Confirm that needed APIs are enabled

  1. Make a note of the name of your GCP project. This value is shown in the top bar of the Google Cloud Platform Console. It will be of the form qwiklabs-gcp- followed by hexadecimal numbers.
  2. In the GCP Console, on the Products & Services () menu, click APIs & services.
  3. Scroll down in the list of enabled APIs, and confirm that both of these APIs are enabled:
  • Google Kubernetes Engine API
  • Google Container Registry API

If either API is missing, click Enable APIs and Services at the top. Search for the above APIs by name and enable each for your current project. (You noted the name of your GCP project above.)

Start a Kubernetes Engine cluster

  1. On the Google Cloud Platform menu, click Activate Google Cloud Shell (). If a dialog box appears, click Start Cloud Shell.
  2. For convenience, place the zone that Qwiklabs assigned you to into an environment variable called MY_ZONE. At the Cloud Shell prompt, type this partial command:

export MY_ZONE=

followed by the zone that Qwiklabs assigned you to. Your complete command will look like this:

export MY_ZONE=us-central1-f

  1. Start a Kubernetes cluster managed by Kubernetes Engine. Name the cluster webfrontend and configure it to run 2 nodes:
gcloud container clusters create webfrontend --zone $MY_ZONE --num-nodes 2
  1. After the cluster is created, check your installed version of Kubernetes using the kubectl version command:
kubectl version
  1. View your running nodes in the GCP Console. On the Products & Services menu, click Compute Engine > VM Instances.

Run and deploy a container

  1. From your Cloud Shell prompt, launch a single instance of the nginx container. (Nginx is a popular web server.)
kubectl run nginx --image=nginx:1.10.0
  1. View the pod running the nginx container:
kubectl get pods
  1. Expose the nginx container outside Kubernetes:
kubectl expose deployment nginx --port 80 --type LoadBalancer
  1. View the new service:
kubectl get services

You can use the displayed external IP address to test and contact the nginx container remotely.

  1. Open a new web browser tab and paste your cluster's external IP address into the address bar. The default home page of the Nginx browser is displayed.
  2. Scale up the number of pods running on your service:
kubectl scale deployment nginx --replicas 3
  1. Confirm that Kubernetes has updated the number of pods:
kubectl get pods
  1. Confirm that your external IP address has not changed:
kubectl get services
  1. Return to the web browser tab in which you viewed your cluster's external IP address. Refresh the page to confirm that the nginx web server is still responding.


  1. In the GCP Console, sign out of the Google account.
  2. Close the browser tab.

End your lab

When you have completed your lab, click End. Qwiklabs removes the resources you've used and cleans the account for you.

You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.

The number of stars indicates the following:

  • 1 star = Very dissatisfied
  • 2 stars = Dissatisfied
  • 3 stars = Neutral
  • 4 stars = Satisfied
  • 5 stars = Very satisfied

You can close the dialog box if you don't want to provide feedback.


In this lab you configured a Kubernetes cluster in Kubernetes Engine. You populated the cluster with several pods containing an application, exposed the application, and scaled the application.

More resources

Read the Google Cloud Platform documentation on Kubernetes Engine.

Manual Last Updated October 25, 2017
Provide Feedback on this Lab
My Learning
My Learning
My Account
My Account