Kubernetes 101 : Stopping and deleting Pods by scaling down the Deployment
We will use the below deployment to start two replicas of "nginx":
Below the Yaml file of the deployment:
We can then create the deployment using the below command:
Below is the command to display the pods, while watching them with the "-w" option:
To remove the pods, we scale their deployment back to "zero" as we can see below:
We can check the changes while watching the pods using the below command with the "-w" option:
If we try to delete the pods directly using the below command, the deployment will restart other replicas of the same pod to keep the number of replicas equal to that in the Yaml file above, "replicas: 2".