/
CA Build and Deploy a Docker Image to a Kubernetes Cluster
37 lines (22 loc) · 1.52 KB
/
CA Build and Deploy a Docker Image to a Kubernetes Cluster
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Built Docker image with tag V1
gsutil cp gs://sureskills-ql/challenge-labs/ch04-kubernetes-app-deployment/echo-web.tar.gz .
OR
gsutil cp gs://$DEVSHELL_PROJECT_ID/echo-web.tar.gz .
--------------------------------------------------------------------------------------------------------------------------------
Extract downloaded zip
tar -xvf echo-web.tar.gz
gcloud builds submit --tag gcr.io/$DEVSHELL_PROJECT_ID/echo-app:v1 .
--------------------------------------------------------------------------------------------------------------------------------
Create Kubernetes cluster
gcloud container clusters create echo-cluster --num-nodes 2 --zone us-central1-a --machine-type n1-standard-2
--------------------------------------------------------------------------------------------------------------------------------
Deploy application to Kubernetes cluster
kubectl create deployment echo-web --image=gcr.io/qwiklabs-resources/echo-app:v1
--------------------------------------------------------------------------------------------------------------------------------
Expose app to allow external access
kubectl expose deployment echo-web --type=LoadBalancer --port=80 --target-port=8000
--------------------------------------------------------------------------------------------------------------------------------
Extract Kubernetes services
kubectl get svc
--------------------------------------------------------------------------------------------------------------------------------
Congratulations, you're all done with the lab 😄