Deploy Applications with GKE Autopilot

Lab 25 minuti universal_currency_alt 1 credito show_chart Introduttivi
info Questo lab potrebbe incorporare strumenti di AI a supporto del tuo apprendimento.
Questi contenuti non sono ancora ottimizzati per i dispositivi mobili.
Per un'esperienza ottimale, visualizza il sito su un computer utilizzando un link inviato via 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.

Prima di iniziare

  1. I lab creano un progetto e risorse Google Cloud per un periodo di tempo prestabilito
  2. I lab hanno un limite di tempo e non possono essere messi in pausa. Se termini il lab, dovrai ricominciare dall'inizio.
  3. In alto a sinistra dello schermo, fai clic su Inizia il lab per iniziare

Utilizza la navigazione privata

  1. Copia il nome utente e la password forniti per il lab
  2. Fai clic su Apri console in modalità privata

Accedi alla console

  1. Accedi utilizzando le tue credenziali del lab. L'utilizzo di altre credenziali potrebbe causare errori oppure l'addebito di costi.
  2. Accetta i termini e salta la pagina di ripristino delle risorse
  3. Non fare clic su Termina lab a meno che tu non abbia terminato il lab o non voglia riavviarlo, perché il tuo lavoro verrà eliminato e il progetto verrà rimosso

Questi contenuti non sono al momento disponibili

Ti invieremo una notifica via email quando sarà disponibile

Bene.

Ti contatteremo via email non appena sarà disponibile

Un lab alla volta

Conferma per terminare tutti i lab esistenti e iniziare questo

Utilizza la navigazione privata per eseguire il lab

Il modo migliore per eseguire questo lab è utilizzare una finestra del browser in incognito o privata. Ciò evita eventuali conflitti tra il tuo account personale e l'account studente, che potrebbero causare addebiti aggiuntivi sul tuo account personale.