实验设置说明和要求
保护您的账号和进度。请务必在无痕浏览器窗口中,使用实验凭证运行此实验。

Google Cloud Fundamentals: Getting Started with GKE (AWS)

实验 35 分钟 universal_currency_alt 5 积分 show_chart 入门级
info 此实验可能会提供 AI 工具来支持您学习。
此内容尚未针对移动设备进行优化。
为获得最佳体验,请在桌面设备上访问通过电子邮件发送的链接。

As a cloud architect, your designs for multi-tier architectures include the compute layer. In general, you deploy containers to satisfy your organization's computational needs. Some of your considerations as you complete your designs include the following:

  • How can you deploy containers and manage them centrally using Kubernetes?
  • How can you group your containers in clusters?
  • How to ensure that your clusters are optimized for performance and efficiency?

In Amazon Web Services (AWS), you deploy containers through Amazon Elastic Kubernetes Service (EKS). Through Kubernetes, EKS manages the availability and scalability of your Kubernetes control plane nodes, which are responsible for scheduling containers, managing application availability, and storing cluster data. Your containerized architecture on AWS EKS looks like the following:

AWS Diagram

Now you will explore how to create a zonal Google Kubernetes Engine (GKE) cluster to allocate your containers.

Overview

In this lab, you create a Google Kubernetes Engine cluster containing several containers, each containing a web server. You place a load balancer in front of the cluster and view its contents.

Objectives

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

Task 1. Sign in to the Google Cloud

For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.

  1. Sign in to Google Skills using an incognito window.

  2. Note the lab's access time (for example, 1:15:00), and make sure you can finish within that time. There is no pause feature. You can restart if needed, but you have to start at the beginning.

  3. When ready, click Start lab.

  4. Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.

  5. Click Open Google Console.

  6. Click Use another account and copy/paste credentials for this lab into the prompts. If you use other credentials, you'll receive errors or incur charges.

  7. Accept the terms and skip the recovery resource page.

Task 2. Confirm that needed APIs are enabled

  1. Make a note of the name of your Google Cloud project. This value is shown in the top bar of the Google Cloud Console. It will be of the form qwiklabs-gcp- followed by hexadecimal numbers.

  2. In the Google Cloud Console, on the Navigation menu (Navigation menu icon), click APIs & Services.

  3. Scroll down in the list of enabled APIs, and confirm that both of these APIs are enabled:

  • Kubernetes Engine API
  • Artifact Registry API

If either API is missing, click Enable APIs and Services at the top. Search for the above APIs by name and enable each for your current project. (You noted the name of your GCP project above.)

Task 3. Start a Kubernetes Engine cluster

  1. In Google CLoud console, on the top right toolbar, click the Activate Cloud Shell button.

    Cloud Shell icon

  2. Click Continue.

  3. For convenience, place the zone that Google Skills assigned to you into an environment variable called MY_ZONE. At the Cloud Shell prompt, type this partial command:

    export MY_ZONE=

    followed by the zone that Google Skills assigned to you. Your complete command will look similar to this:

    export MY_ZONE=us-central1-a
  4. Start a Kubernetes cluster managed by Kubernetes Engine. Name the cluster webfrontend and configure it to run 2 nodes:

    gcloud container clusters create webfrontend --zone $MY_ZONE --num-nodes 2

    It takes several minutes to create a cluster as Kubernetes Engine provisions virtual machines for you.

  5. After the cluster is created, check your installed version of Kubernetes using the kubectl version command:

    kubectl version

    The gcloud container clusters create command automatically authenticated kubectl for you.

  6. View your running nodes in the GCP Console. On the Navigation menu (Navigation menu icon), click Compute Engine > VM Instances.

    Your Kubernetes cluster is now ready for use.

    Click Check my progress to verify the objective. Start a Kubernetes Engine cluster

Task 4. Run and deploy a container

  1. From your Cloud Shell prompt, launch a single instance of the nginx container. (Nginx is a popular web server.)

    kubectl create deploy nginx --image=nginx:1.17.10

    In Kubernetes, all containers run in pods. This use of the kubectl create command caused Kubernetes to create a deployment consisting of a single pod containing the nginx container. A Kubernetes deployment keeps a given number of pods up and running even in the event of failures among the nodes on which they run. In this command, you launched the default number of pods, which is 1.

Note: If you see any deprecation warning about future versions, you can simply ignore it for now and can proceed further.
  1. View the pod running the nginx container:

    kubectl get pods
  2. Expose the nginx container to the Internet:

    kubectl expose deployment nginx --port 80 --type LoadBalancer

    Kubernetes created a service and an external load balancer with a public IP address attached to it. The IP address remains the same for the life of the service. Any network traffic to that public IP address is routed to pods behind the service: in this case, the nginx pod.

  3. View the new service:

    kubectl get services

    You can use the displayed external IP address to test and contact the nginx container remotely.

    It may take a few seconds before the External-IP field is populated for your service. This is normal. Just re-run the kubectl get services command every few seconds until the field is populated.

  4. Open a new web browser tab and paste your cluster's external IP address into the address bar. The default home page of the Nginx browser is displayed.

  5. Scale up the number of pods running on your service:

    kubectl scale deployment nginx --replicas 3

    Scaling up a deployment is useful when you want to increase available resources for an application that is becoming more popular.

  6. Confirm that Kubernetes has updated the number of pods:

    kubectl get pods
  7. Confirm that your external IP address has not changed:

    kubectl get services
  8. Return to the web browser tab in which you viewed your cluster's external IP address. Refresh the page to confirm that the nginx web server is still responding.

Click Check my progress to verify the objective. Run and deploy a container

Congratulations!

In this lab, you configured a Kubernetes cluster in Kubernetes Engine. You populated the cluster with several pods containing an application, exposed the application, and scaled the application.

Because Kubernetes is open source, this containerized environment has high portability and adaptability. Thus, deploying Kubernetes is similar across all platforms.

Here is a recap of the similarities and differences between these services:

Similarities:

  • GKE and EKS are both managed Kubernetes services that allow customers to deploy, manage, and scale containerized applications in the cloud.
  • Both Google Cloud and AWS offer the Kubernetes service as a Platform as a Service (PaaS).
  • GKE and EKS can use YAML files for deployments.
  • Both GKE and EKS can apply the same principles for containers and deployments to populate a cluster.
  • Both GKE and EKS can use kubectl to deploy and manage Docker containers.

Differences:

  • There are relatively no differences between GKE and EKS regarding the implementation of Kubernetes. The differences occur in the provisioning of the infrastructure and management of the service.
  • Google GKE offers a feature called GKE Autopilot, which provides a fully managed and optimized Kubernetes experience without the need for users to manage the underlying infrastructure. Autopilot is beyond the scope of this course. You can learn more here.

End your lab

When you have completed your lab, click End Lab. Google Skills 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:

  • 1 star = Very dissatisfied
  • 2 stars = Dissatisfied
  • 3 stars = Neutral
  • 4 stars = Satisfied
  • 5 stars = Very satisfied

You can close the dialog box if you don't want to provide feedback.

For feedback, suggestions, or corrections, please use the Support tab.

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.

准备工作

  1. 实验会创建一个 Google Cloud 项目和一些资源,供您使用限定的一段时间
  2. 实验有时间限制,并且没有暂停功能。如果您中途结束实验,则必须重新开始。
  3. 在屏幕左上角,点击开始实验即可开始

使用无痕浏览模式

  1. 复制系统为实验提供的用户名密码
  2. 在无痕浏览模式下,点击打开控制台

登录控制台

  1. 使用您的实验凭证登录。使用其他凭证可能会导致错误或产生费用。
  2. 接受条款,并跳过恢复资源页面
  3. 除非您已完成此实验或想要重新开始,否则请勿点击结束实验,因为点击后系统会清除您的工作并移除该项目

此内容目前不可用

一旦可用,我们会通过电子邮件告知您

太好了!

一旦可用,我们会通过电子邮件告知您

一次一个实验

确认结束所有现有实验并开始此实验

使用无痕浏览模式运行实验

使用无痕模式或无痕浏览器窗口是运行此实验的最佳方式。这可以避免您的个人账号与学生账号之间发生冲突,这种冲突可能导致您的个人账号产生额外费用。