Chapter 4: Creating a Kubernetes Cluster
Activity 4: Migrating a Running Application in Kubernetes Cluster
Solution:
Perform the following steps to complete this activity:
- Run a sample web application with six replicas in the cluster:
kubectl run hello-world --image=gcr.io/google-samples/hello-app:1.0 --replicas=6
Figure 4.30: Creating hello-world application
- Check the status of pods of the sample web application and their nodes:
kubectl get pods -o wide
Figure 4.31: Pods and their nodes of the hello-world application
- Create a node pool in GCP with a larger memory:
gcloud container node-pools create high-memory-pool --cluster=devops \ --machine-type=n1-highmem-2 --num-nodes=2
Figure 4.32: Node pool creation
- Wait until all nodes are
Ready
in the cluster:kubectl get nodes --label-columns=beta.kubernetes.io/instance-type
Figure 4.33: Kubernetes nodes after pool creation
- Mark the nodes in the default node pool as unschedulable and make Kubernetes move the workloads...