-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask_three.txt
43 lines (27 loc) · 1.75 KB
/
task_three.txt
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
38
39
40
41
42
43
Steps for deploying GKE app(scalable & highly available) with rolling update strategy.
1.Get the source code and Dockerfile from github...git clone
2.Then, build the container image with a tag that includes your GCP project ID
docker build -t gcr.io${DEVSHELL_PROJECT_ID}hello-appv1 .
3.Authenticate to the registry ,and then push the image
gcloud auth configure-docker
docker push gcr.io${DEVSHELL_PROJECT_ID}hello-appv1
4.Create a Kubernetes Cluster in GKE with (autoscalling and regional cluster for high availability) enabled
gcloud container clusters create lordson-cluster --zone us-central1-a --service-account
5.Connect to the cluster .check the nods running.
gcloud container clusters get credential lordson-cluster --zone us-central1-a
6.Create a deployment from image & scale no.of pods
kubectl create deployment hello-world --image=gcr.io${DEVSHELL_PROJECT_ID}hello-appv1
7.Create a HorizontalPodAutoscaler resource for your Deployment
kubectl autoscale deployment hello-app --cpu-percent=80 --min=1 --max=5
8.check the Kubernetes metrics in GKE with the kubectl top command
kubectl top pods
kubectl top nodes
9.Exposing the sample app to the internet
kubectl expose deployment hello-world --type=LoadBalancer --port 80 --target-port 8080
10.get the Service details for your app .and check the EXTERNAL_IP address
kubectl get service
11.Deploying a new version of the sample app & verify the same.
Build and push a new hello-appv2 Docker image to registry.
docker build -t gcr.io${DEVSHELL_PROJECT_ID}hello-appv2 .
Apply a rolling update to the existing Deployment with an image update
kubectl set image deployment hello-appv2 hello-app=hello-appv2