Deploy Applications with GKE Autopilot

Lab 25 годин universal_currency_alt 1 кредит show_chart Початковий
info This lab may incorporate AI tools to support your learning.
This content is not yet optimized for mobile devices.
For the best experience, please visit us on a desktop computer using a link sent by email.

GSP957

Google Cloud self-paced labs logo

Overview

Google Kubernetes Engine (GKE) is a managed, production-ready environment for running containerized applications using Kubernetes. GKE Autopilot is a managed mode of operation in which Google manages your cluster infrastructure, including nodes, scaling, security, and other preconfigured settings. In Autopilot mode, GKE provisions compute resources based on your Kubernetes manifests, allowing you to focus on application development rather than operational maintenance.

In this lab, you containerize a sample application and deploy it to a GKE Autopilot cluster. You use Skaffold to automate the build and deployment process and verify the application's availability via an external load balancer.

What you'll learn

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

  • Containerize a sample application for deployment.
  • Deploy an application to a GKE Autopilot cluster.
  • Verify the availability of a deployed workload via an external load balancer.

Benefits of Autopilot

The features you explore in this lab provide significant advantages for production workloads outside of this environment:

Automated infrastructure management: Node configuration, sizing, and bin-packing are managed automatically, allowing teams to focus entirely on application logic rather than infrastructure maintenance.

Hands-free scaling: capacity scales automatically with workload demand, eliminating manual capacity planning and ensuring responsiveness under varying traffic patterns.

Hardened security by default: Automated node patching and restricted images provide a production-ready security posture out of the box without manual hardening.

Resource-based pricing: You are billed only for the resources (CPU, memory, and storage) requested by your pods, ensuring you don't pay for idle infrastructure overhead.

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 are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials 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 (recommended) or private browser window to run this lab. This prevents 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: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

Task 1. Access Cloud Code

This lab uses 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.

  • Paste the IDE URL below into a new browser window:

    {{{ project_0.startup_script.service_url | "IDE" }}} Note:
    This lab uses a development environment to access services. You control the GKE Autopilot cluster directly from this environment.

Task 2. Clone the repository

In this task, you clone the application's source code repository to prepare the environment for deployment.

  1. In your Cloud Code terminal, click Source control > Clone repository from the left pane.

    Source Control button highlighted

  2. Paste the following GitHub repository into Provide repository URL or pick a repository source. field:

    https://github.com/subfuzion/voting-demo.git
  3. Click Clone from URL.

  4. Click OK to confirm the location.

  5. When prompted to open the repo, click Open.

  6. If prompted, click Yes, I trust the authors.

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

Task 3. Add your cluster to the kubeconfig

GKE Autopilot is pre-provisioned for this lab. In this task, you update the local kubeconfig to point to the cluster. After the update is complete, you deploy the demo application.

  1. On the Navigation menu (Navigation menu icon) click Terminal > New Terminal.

    open a new terminal

    Note:
    GKE uses the gke-gcloud-auth-plugin to manage authentication between the client and GKE. This binary uses the Kubernetes Client-go Credential Plugin mechanism to provide GKE-specific authentication tokens.
  2. Add the cluster credentials to the local kube-config:

    Note: To paste code into the terminal, press CTRL+SHIFT+V 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

    Note: It may take a few minutes for this check to verify.

Task 4. Build and deploy the app

This lab utilizes Skaffold to build and deploy containers to Artifact Registry.

  1. In the terminal, change to the application folder:

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

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

    skaffold run --default-repo=gcr.io/{{{ project_0.project_id | "PROJECT_ID" }}}/voting-app --tail Note: The deployment takes a minute to spin up the resources, ignore any warning or error messages.

    A container image is built from source. Once available it's 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: On the Navigation menu (Navigation menu icon) click Terminal > New Terminal.

  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:

    http://[web-external-ip] Note: If warned about an insecure connection, click Continue to site.

    Expected output:

    Voting app displays two options: tabs or spaces

Task 6. Test the app

  1. Vote by clicking either TABS or SPACES.

    Note: Click either button as many times as you like. The results reflect the button last clicked.
  2. Update the voting app URL as follows:

    http://[web-external-ip]/results

    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. To terminate your application, press CTRL+C in the terminal running the application:

Although you've terminated the application, the skaffold application is still active. If you re-run the skaffold application, it would use the existing resources created earlier.

  1. To delete the application, you tell Skaffold that the application is no longer required:

    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

Congratulations!

You have successfully deployed a containerized application to GKE Autopilot!

Next steps / Learn more

Search for "Qwik Starts" in the Google Skills catalog to find your next lab.

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 Skills 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 March 5, 2026

Lab Last Tested March 5, 2026

Copyright 2026 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.

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

This content is not currently available

We will notify you via email when it becomes available

Great!

We will contact you via email if it becomes available

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

Using an Incognito or private browser window is the best way 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.