GKE Autopilot: Qwik Start

Sign in Join
Test and share your knowledge with our community!
Get access to over 700 hands-on labs, skill badges, and courses

GKE Autopilot: Qwik Start

Lab 45 minutes universal_currency_alt 1 Credit show_chart Introductory
info This lab may incorporate AI tools to support your learning
Test and share your knowledge with our community!
Get access to over 700 hands-on labs, skill badges, and courses


Google Cloud self-paced labs logo


Google Kubernetes Engine (GKE) Autopilot is a new managed mode of operation in which Google creates, sizes, and automatically scales on your behalf the physical infrastructure needed to run your application workloads.

In this lab, you get hands-on practice containerizing an application and deploying it to an GKE Autopilot cluster using a Kubernetes configuration and commands.

Simplifying GKE with Autopilot

On GKE your compute infrastructure consists of nodes based on individual compute instances.
A group of nodes is called a cluster. Powering GKE is Kubernetes, an open source cluster orchestration platform that is heavily influenced by over fifteen years of Google's experience running production workloads in containers. Kubernetes draws on the same design principles for running popular Google services at global scale to provide:

  • Automatic management
  • Monitoring and liveness probes for application containers
  • Automatic scaling
  • Rolling updates

With GKE Autopilot, you reap the benefits of Google's ability to optimize and configure a cluster using best practices for high availability and security, monitor the health of the cluster, and recalculate the cluster capacity needed to run your workloads at any given moment.

GKE Autopilot liberates you, the developer, to focus on application development, and not operational maintenance. You're still using Kubernetes to run the mission-critical mix of stateless and stateful services your application requires.

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab---remember, once you start, you cannot pause a lab.
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab to avoid extra charges to your account.

Task 1. Access Cloud Code

An integrated development environment (IDE) with the Cloud Code extension has already been set up to easily deploy workloads to a GKE cluster. This lab is using Cloud Code to access Google Cloud products and services. You can view information about your cluster resources from the editor or via the command line.

  1. Copy the IDE URL from the Lab details panel.

  2. Paste it into a new browser window:

    The lab environment is uses a development environment to access services. You can control the GKE Autopilot cluster directly from this environment.

Task 2. Clone repo

The first task is to clone a repo with the code to be run. Retrieve the source code under version control to begin the lab.

  1. In your Cloud Code environment, select the Source Control button from the sidebar.

    Source Control button highlighted

  2. Click the Clone Repository button.

  3. Paste the following GitHub repository into the prompted search bar:
  4. Click Clone from URL in the dropdown list under the search bar.

  5. Click OK to confirm the location.

    If prompted with a pop up asking about trusting the folders, select Yes I trust the Authors.
  6. When prompted to open the folder of the repo, click Open.

    Click Check my progress to verify the objective. Clone the Repository

Task 3. Add your cluster to the KubeConfig

GKE Autopilot has been pre-provisioned within the lab. In this section, you will update the environment KubeConfig to point to the cluster. Once the update is complete, you can then commence the deployment of the demo application.

  1. Visit the Navigation Menu and select Terminal > New Terminal.

    open a new terminal

    Existing versions of kubectl and custom Kubernetes clients contain provider-specific code to manage authentication between the client and Google Kubernetes Engine. Starting with v1.26, this code will no longer be included as part of the OSS kubectl.
    GKE users will need to download and use a separate authentication plugin to generate GKE-specific tokens. This new binary, gke-gcloud-auth-plugin, uses the Kubernetes Client-go Credential Plugin mechanism to extend kubectl’s authentication to support GKE.
    For more information, you can check out the following documentation.
  2. Add the cluster credentials to the local kube-config

    gcloud container clusters get-credentials dev-cluster --region {{{project_0.default_region | Region}}}

    Expected output:

    Fetching cluster endpoint and auth data. kubeconfig entry generated for dev-cluster.

    Click Check my progress to verify the objective. Add cluster to the KubeConfig

    It can sometimes take a few minutes for this check to verify.

Task 4. Build and deploy the app

Before you can deploy an application, you need a container for that application. In this environment, you will utilize a skaffold manifest which builds the web and vote containers. The lab uses artifact registry to host the container images and then deploys the images using Kubernetes manifests.

  1. Open a terminal, if one is not available

  2. Change to the application folder

    cd ~/voting-demo/v2
  3. Set the region for the deployment

    gcloud config set compute/region {{{ project_0.default_region | "REGION" }}}
  4. Use skaffold to deploy the source application

    skaffold run{{{ project_0.project_id | "PROJECT_ID" }}}/voting-app --tail Note:
    The deployment will take a minute to spin up the resources.
    A container image will be built from source and then once available it will be deployed to the GKE autopilot cluster.

    Click Check my progress to verify the objective. Deploy the App

Task 5. Run the app

Now test that the application is working as specified.

  1. Launch a new terminal to test the application.

  2. Run the command below to verify the web-external load balancer has been created

    kubectl get svc web-external --output=json | jq -r .status.loadBalancer.ingress[0].ip Note:
    It may take a moment for the load balancer to return an IP address. Please wait until an IP is returned before moving on.
  3. Open a new tab in your browser

  4. Enter the IP value returned as a HTTP site


    Expected output:

    Voting app displays two options: tabs or spaces

    The application deployed to GKE Autopilot is now accessible on the internet.

Task 6. Test the app

  1. Vote for either TABS or SPACES.

    Press either button as many times as you like. We will test the input in the next step.
  2. Update the voting app URL as follows:


    Example output:

    { "results": { "a": 0, "b": 1 }, "success": true }

    Click Check my progress to verify the objective. Test the App

    Great job! You now have your voting application deployed to a cluster. GKE Autopilot has taken care of the management of the Kubernetes infrastructure.

Task 7. Clean up

  1. Terminate your application by pressing CTRL-C in the terminal running the application.

    The skaffold application is still active. If we re-run the skaffold application, it will use the existing resources we created earlier.
    How do we delete the application? We need to tell skaffold that the application is no longer required.
  2. Tell Skaffold to delete the resources

    skaffold delete

    Expected output:

    Cleaning up... - deployment.apps "database" deleted - service "database" deleted - deployment.apps "vote" deleted - service "vote" deleted - deployment.apps "web" deleted - service "web" deleted - service "web-external" deleted

    Click Check my progress to verify the objective. Delete App from cluster


You have just deployed a containerized application to Google Kubernetes Engine! In this lab you have performed the following tasks:

  • Cloned an external public repository
  • Updated the KubeConfig to use GKE Autopilot cluster
  • Used Skaffold to create a remote artifact registry image without needing to install software
  • Deployed an application to GKE Autopilot
  • Tested the application endpoint using HTTP
  • Cleaned up existing deployed resources

Next steps / Learn more

This lab is part of a series of labs called Qwik Starts. These labs are designed to give you some experience with the many features available on Google Cloud. Search for "Qwik Starts" in the Cloud Skills Boost catalog to find the next lab you'd like to take!

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated June 03, 2024

Lab Last Tested June 03, 2024

Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.