
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Enable relevant APIs and grant the necessary IAM roles
/ 30
Configure Google Kubernetes Engine
/ 30
Use kubectl to deploy a set of microservices
/ 20
Create a repository
/ 20
In this lab, you use Gemini, an AI-powered collaborator in Google Cloud, to investigate logs and set up a build environment for a set of microservices in Google Kubernetes Engine (GKE).
This lab is intended for engineers of any experience level working in a DevOps environment.
In this lab, you learn how to perform the following tasks:
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details panel.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that contains development tools. It offers a persistent 5-GB home directory and runs on Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources. gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab completion.
Click the Activate Cloud Shell button () at the top right of the console.
Click Continue.
It takes a few moments to provision and connect to the environment. When you are connected, you are also authenticated, and the project is set to your PROJECT_ID.
(Output)
(Example output)
(Output)
(Example output)
Sign in to the Google Cloud console with your lab credentials, and open the Cloud Shell terminal window.
To set your project ID and region environment variables, in Cloud Shell, run the following commands:
To store the signed-in Google user account in an environment variable, run the following command:
Enable the Cloud AI Companion API for Gemini:
To use Gemini, grant the necessary IAM roles to your Google Cloud Qwiklabs user account:
Adding these roles lets the user use Gemini assistance.
To verify the objective, click Check my progress.
In this task, you enable the Google Kubernetes Engine (GKE) API, give yourself the permissions required to manage a GKE cluster, and create a cluster.
In Cloud Shell, to enable the GKE API, run the following command:
To grant your user admin permissions for GKE, run the following command:
You can create a zonal GKE cluster to run your microservices. Gemini can tell you how to create it.
In the Google Cloud console, if you don't see the Open or close Gemini AI chat () menu, refresh the page.
To open the Gemini pane, in the Google Cloud console top menu, click Open or close Gemini AI chat (), and then, if required, click Enable.
Click Start Chatting.
For the Gemini prompt, type the text below, and then click Send Prompt ():
Gemini should provide a response similar to this:
To create a zonal GKE cluster, run the following command:
The cluster takes a few minutes to create. Wait for the command to finish.
To verify the objective, click Check my progress.
In this task, you clone a repository that contains the code for several microservices that make up an online boutique application. You also use kubectl to deploy these microservices to the GKE cluster.
Here's an architecture diagram for the application:
In Cloud Shell, to clone the repository, run the following command:
This repository contains the source code for each microservice in the application.
To deploy the microservices to GKE, run the following commands:
To check the deployment status, until each microservice is available, repeat the following command:
When each microservice is available, the corresponding value in the Available column will be set to 1. The kubectl get deployments
command will look similar to this:
The application is accessed by its external IP address.
To determine the URL for the application, run the following command:
To open the application in a browser tab, hold Control (for Windows and Linux) or Command (for macOS) and then click the URL in the Cloud Shell.
The home page of the application opens. You can try out the application.
To verify the objective, click Check my progress.
Imagine that you're a DevOps engineer who has inherited an existing set of microservices to manage. These microservices run in a GKE cluster. To understand the environment, you decide to inspect logs from the various microservices.
In this task, you use Gemini to help design queries to search for specific logs and explain log entries.
On the Google Cloud console title bar, type Logs Explorer in the Search field, then click Logs Explorer in the search results.
For the Gemini prompt, type the text below, and then click Send Prompt ():
You should receive a response that provides a query that looks similar to this:
In the Query box, paste the query, and then click Run query.
Log messages are now filtered to only be messages originating from the test GKE cluster. You can now explore the log entries.
To learn about a log entry, expand a log entry, and then click Explain this log entry.
For example, if you click the explain button for a log entry GET /product/0PUK6V6EV0
, you might get a response from Gemini that looks like this:
After exploring the log explanations for your workloads, you now decide that you should set up infrastructure to build your team's future container images on a set of private workers with no access to the internet.
In this task, you use Gemini to help identify how to create and run a private build environment.
You are responsible for setting up a build system for a sensitive project. You have heard that Cloud Build is a service for performing builds on Google Cloud, and that Cloud Build uses worker pools to run your builds.
In the Gemini chat, to find out more about worker pools, enter the following prompt:
Gemini might provide a response that begins similar to this:
The security provided by private worker pools might be a good choice for your project. It would be even better if the builds can be blocked from accessing the public internet.
In the Gemini chat, enter the following prompt:
Gemini might provide a response similar to this:
Great, this should be very secure. You realize that the workers of a private pool won't have access to public package repositories like PyPI. Knowing that you will need to host private packages, you wonder if Artifact Registry can be used.
In the Gemini chat, enter the following prompt:
Gemini might provide a response similar to this:
OK, let's have Gemini provide us the gcloud CLI command to create the private pool.
In the Gemini chat, enter the following prompt:
Gemini might provide a command similar to this:
To create the private pool, run the following command:
The lab environment likely returns an error message that looks like this:
You can ignore this error message in this lab.
Now let's ask Gemini how to create the private Docker repository.
In the Gemini chat, enter the following prompt:
Gemini might provide a response that includes a gcloud CLI command similar to this:
To create the repository, run the following command:
The repository is created.
To verify the objective, click Check my progress.
When you have completed your lab, click End Lab. Qwiklabs removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
In this lab you learned how to:
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.
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