- Lab
- A Cloud Guru
Deploying to a Google Kubernetes Engine Cluster
The strength and flexibility of Kubernetes is built around the concept of containerized applications, which are deployed differently from non-containerized apps. In this hands-on lab, you’ll complete all the steps from creating a Kubernetes cluster to confirming the deployed application, including creating the Docker image of your application, pushing that image to Container Registry, deploying the workload, and then configuring a load balancer to expose it.
Path Info
Table of Contents
-
Challenge
Create the Kubernetes Engine cluster.
- From the Kubernetes Engine Clusters page, click Create cluster.
- Configure the new cluster:
- Name the cluster
- Change the number of nodes to 4
- Under Nodes, Machine Configuration, General-Purpose, change the Series to "N1" and the Machine type to "n1-standard-1".
- Leave all other settings at their default
- Click Create.
-
Challenge
Get the files.
- Clone the GitHub repository: git clone https://github.com/linuxacademy/content-gcpro-developer
- Change directory with the following command: cd content-gcpro-developer/kubernetes-engine-lab
-
Challenge
Configure the `config.yaml` file.
- In the Cloud Shell Editor, open the
config.yaml
file. - On line 32, replace
[PROJECT_ID]
with your project ID. - Choose the file and then select Save.
- In the Cloud Shell Editor, open the
-
Challenge
Build the containerized Docker image.
In the Cloud Shell, execute the following command:
docker build -t la-container-image .
-
Challenge
Push the containerized app into the Container Registry.
- In the Cloud Shell, configure Docker to use the
gcloud
command: gcloud auth configure-docker - Tag the image with the registry name: docker tag la-container-image gcr.io/[PROJECT_ID]/la-container-image:v1
- Push the image to the Container Registry: docker push gcr.io/[PROJECT_ID]/la-container-image:v1
- In the Cloud Shell, configure Docker to use the
-
Challenge
Confirm the operation.
- Navigate to Container Registry Images.
- Confirm the existence of
la-container-image
.
-
Challenge
Deploy the workload.
- Navigate to Kubernetes Engine > Workloads.
- Click Deploy.
- Choose the existing container image.
- Click Deploy.
-
Challenge
Increase the number of pods.
- Navigate to the YAML tab.
- Click Edit.
- Change the number of
replicas
to4
. - Click Save.
- Confirm the operation.
-
Challenge
Expose the deployment.
- From the Deployment Details page, click Expose.
- Set the Service type to Load balancer.
- Click Expose.
- Confirm by clicking the External IP link.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.