arrow_back

GKE Autopilot: Qwik Start

Join Sign in

GKE Autopilot: Qwik Start

45 minutes 1 Credit

GSP957

Google Cloud Self-Paced Labs

Overview

Autopilot is a new managed mode of operation for Google Kubernetes Engine (GKE) 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 Autopilot cluster using Kubernetes configuration and commands.

Simplifying GKE with Autopilot

On GKE your compute infrastructure consists of individual compute instances, called nodes. The set of nodes dedicated to your application is called a cluster. Powering GKE is Kubernetes, an open source cluster management system 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 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.

Autopilot liberates you, the developer, to focus on application development, not operational maintenance. Because you're running on GKE, you're still using Kubernetes to run the mission-critical mix of stateless and statefull 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.

What you need

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
  • Time to complete the lab.

Note: If you already have your own personal Google Cloud account or project, do not use it for this lab.

Note: If you are using a Chrome OS device, open an Incognito window to run this lab.

Task 1: Access Cloud Code

A Cloud Code development environment has already been set up to easily deploy workloads to a GKE cluster.

  1. Copy the IDE URL from the lab panel

  2. Paste it into a new browser window:

cloud-code-welcome.png

The lab environment is based on a development environment. In this environment, control the remote GKE Autopilot cluster from the IDE.

Task 2: Clone Repo

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.png

  1. Click the Clone Repository button.

  2. Paste the following GitHub repository into the prompted search bar:

https://github.com/subfuzion/voting-demo.git
  1. Click Clone from URL in the dropdown list under the search bar.

  2. Click OK to confirm the location.

  3. When prompted to open the folder of the repo, click Open.

cloneRepo.gif

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

Task 3: Add Your Cluster to the KubeConfig

A GKE Autopilot cluster has been preprovisioned within the lab. In this section, you will update the Cloud Code's KubeConfig to point to the cluster. Once the update is complete, you can then commence the deployment of the demo application.

  1. Select the Cloud Code - Kubernetes button from the side panel.

cloud-code-kubernetes.png

  1. Click the Add a cluster to the KubeConfig button.

add-a-cluster.png

After pressing the button, you should see a dialog begin at the top your Cloud Code window.

  1. For platform, choose Google Kubernetes Engine.
The list of available clusters can take a moment to render in the menu.
  1. When asked to create or choose a cluster for your project, select the dev-cluster.

dev-cluster.png

On success, you should see this message pop up:

Successfully added cluster 'dev-cluster' to the kubeconfig

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 we can deploy an application, we need a container for our application. In this environment, you will utilize a skaffold manifest which builds the web and vote containers to google container registry and then deploys your application's Kubernetes manifests which use these container images.

  1. Select the Cloud Code - Kubernetes button from the side panel.

cloud-code-kubernetes.png

  1. Press the Run on Kubernetes button:

run-on-kubernetes.png

  1. From the dropdown that appears, select v2/skaffold.yaml.

  2. Click Yes to use the current context.

  3. Press enter to confirm the default the image registry which should be your project ID.

  4. Watch the progress in the Development Sessions of your Cloud Code - Kubernetes:

progress.png

Wait for the build and deployment process to complete.

While waiting, click on Status to see the logs of the deployment.

You can also click on each individual resource to see isolated logs and output for a particular pod, deployment, or service.

Once you see the green check mark for Status SUCCEEDED, you can move on:

status-succeeded.png

This same deployment could be done on command line through Cloud Code's terminal using the skaffold run --default-repo=gcr.io/$PROJECT_ID/voting-app --tail command.

The Stream Application Logs will continue to stream logs from activity in the voting app. This allows for an alternative, more immediate means of monitoring the application within the IDE.

NOTE: No additional authentication is required and a vastly simplified development workflow is possible.

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

Task 5: Test the App

Finally, you can test that the application is working as specified.

  1. Select the Cloud Code - Kubernetes button from the side panel.

cloud-code-kubernetes.png

  1. In the Development Sessions tab, scroll down until you locate Deployed Resources.

  2. Click on Deployed Resources to unfold it:

deployed-resources.png

  1. Click on Services.

  2. Click on default/web-external.

  3. Click on External IPs:

external-ips.png

  1. Right click on the value under External IPs and select Copy Resource Name.

  2. Open a new tab in your browser and paste the value as your URL.

  3. You should see the frontend for the voting app:

voting-frontend.png

  1. Vote for either TABS or SPACES.

  2. Add /results to the end of the voting app URL to view the voting results so far:

vote-results.png

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 6: Clean Up

Terminate your application by pressing the red square Stop button in your IDE window:

stop-button.png

Click Yes to confirm that resources should be cleaned up on termination.

This way, Cloud Code automatically cleans up your application resources after termination.

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

Congratulations!

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

  • Cloned an external public repository
  • Update the KubeConfig to point to our GKE Autopilot cluster
  • Used Skaffold to create a remote container image without needing to install software
  • Deployed a container to the GKE Autopilot cluster
  • Tested the application using HTTP
  • Cleaned up existing 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 with Google Cloud. Search for "Qwik Starts" in the lab catalog to find the next lab you'd like to take!

Google Cloud Training & 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 February 09, 2022
Lab Last Tested February 09, 2022

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