3.6 KiB
title | description | summary | date | draft | author | tags | canonicalURL | showToc | TocOpen | TocSide | weight | hidemeta | comments | disableHLJS | disableShare | hideSummary | searchHidden | ShowReadingTime | ShowBreadCrumbs | ShowPostNavLinks | ShowWordCount | ShowRssButtonInSectionTermList | cover | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
[GSP304] Build and Deploy a Docker Image to a Kubernetes Cluster | Quest: Cloud Architecture: Design, Implement, and Manage | 2023-05-25T06:46:03+07:00 | false | Hiiruki |
|
true | false | right | 4 | false | false | true | true | false | false | true | true | true | true | true |
|
GSP304
- Time: 1 hour 15 minutes
- Difficulty: Intermediate
- Price: 5 Credits
Lab: GSP304
Quest: Cloud Architecture: Design, Implement, and Manage
Challenge scenario
Your development team is interested in adopting a containerized microservices approach to application architecture. You need to test a sample application they have provided for you to make sure that that it can be deployed to a Google Kubernetes container. The development group provided a simple Go application called echo-web
with a Dockerfile and the associated context that allows you to build a Docker image immediately.
Your challenge
To test the deployment, you need to download the sample application, then build the Docker container image using a tag that allows it to be stored on the Container Registry. Once the image has been built, you'll push it out to the Container Registry before you can deploy it.
With the image prepared you can then create a Kubernetes cluster, then deploy the sample application to the cluster.
-
An application image with a v1 tag has been pushed to the gcr.io repository
mkdir echo-web cd echo-web gsutil cp -r gs://$DEVSHELL_PROJECT_ID/echo-web.tar.gz . tar -xzf echo-web.tar.gz rm echo-web.tar.gz cd echo-web docker build -t echo-app:v1 . docker tag echo-app:v1 gcr.io/$DEVSHELL_PROJECT_ID/echo-app:v1 docker push gcr.io/$DEVSHELL_PROJECT_ID/echo-app:v1
-
A new Kubernetes cluster exists (zone: us-central1-a)
gcloud config set compute/zone us-central1-a gcloud container clusters create echo-cluster --num-nodes=2 --machine-type=n1-standard-2
-
Check that an application has been deployed to the cluster
kubectl create deployment echo-web --image=gcr.io/$DEVSHELL_PROJECT_ID/echo-app:v1
-
Test that a service exists that responds to requests like Echo-app
kubectl expose deployment echo-web --type=LoadBalancer --port 80 --target-port 8000