Deploy Applications with GKE Autopilot

Atelier 25 minutes universal_currency_alt 1 crédit show_chart Débutant
info Cet atelier peut intégrer des outils d'IA pour vous accompagner dans votre apprentissage.
Ce contenu n'est pas encore optimisé pour les appareils mobiles.
Pour une expérience optimale, veuillez accéder à notre site sur un ordinateur de bureau en utilisant un lien envoyé par e-mail.

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.

Avant de commencer

  1. Les ateliers créent un projet Google Cloud et des ressources pour une durée déterminée.
  2. Les ateliers doivent être effectués dans le délai imparti et ne peuvent pas être mis en pause. Si vous quittez l'atelier, vous devrez le recommencer depuis le début.
  3. En haut à gauche de l'écran, cliquez sur Démarrer l'atelier pour commencer.

Utilisez la navigation privée

  1. Copiez le nom d'utilisateur et le mot de passe fournis pour l'atelier
  2. Cliquez sur Ouvrir la console en navigation privée

Connectez-vous à la console

  1. Connectez-vous à l'aide des identifiants qui vous ont été attribués pour l'atelier. L'utilisation d'autres identifiants peut entraîner des erreurs ou des frais.
  2. Acceptez les conditions d'utilisation et ignorez la page concernant les ressources de récupération des données.
  3. Ne cliquez pas sur Terminer l'atelier, à moins que vous n'ayez terminé l'atelier ou que vous ne vouliez le recommencer, car cela effacera votre travail et supprimera le projet.

Ce contenu n'est pas disponible pour le moment

Nous vous préviendrons par e-mail lorsqu'il sera disponible

Parfait !

Nous vous contacterons par e-mail s'il devient disponible

Un atelier à la fois

Confirmez pour mettre fin à tous les ateliers existants et démarrer celui-ci

Utilisez la navigation privée pour effectuer l'atelier

Le meilleur moyen d'exécuter cet atelier consiste à utiliser une fenêtre de navigation privée. Vous éviterez ainsi les conflits entre votre compte personnel et le compte temporaire de participant, qui pourraient entraîner des frais supplémentaires facturés sur votre compte personnel.