In this lesson, you’ll manually edit the Deployment YAML file, increase the number of replicas to 10, and re-send it to Kubernetes.
Check the current number of replicas.
$ kubectl get deployment qsk-deploy
NAME READY UP-TO-DATE AVAILABLE AGE
qsk-deploy 5/5 5 5 4h33m
Edit the deploy.yml file and set the spec.replicas field to 10.
apiVersion: apps/v1
kind: Deployment
metadata:
name: qsk-deploy
spec:
replicas: 5 <<== Change this to 10
selector:
matchLabels:
project: qsk-book
Use kubectl to re-send the updated file to Kubernetes. When Kubernetes receives the file, it will change the stored desired state from 5 replicas to 10 replicas. The Deployment controller will observe 5 replicas on the cluster and notice that it does not match the new desired state of 10. It will spin up 5 new replicas to bring the observed state in line with the desired state.
Note: All the changes that you make are auto-saved on the platform.
$ kubectl apply -f deploy.yml
deployment.apps/qsk-deploy configured
Run a couple of commands to check the status of the Deployment and the number of Pods.
$ kubectl get deployment qsk-deploy
You should get an output that looks like the one shown below:
NAME READY UP-TO-DATE AVAILABLE AGE
qsk-deploy 10/10 10 10 4h43m
$ kubectl get pods