[DOCKER] Stop apps (pods) in Kubernetes

Stop apps (pods) on Kubernetes

In the case of Docker, if you specify the container ID with docker stop, the application will stop, For Kubernetes, there is no stop command.

In this article, a substitute command achieves the same state as a stop.

Setting the number of replicas

The number of Kubernetes application (Pod) launches is determined by the number of replicas. By specifying "1" or more, the specified number of pods will be started.

By applying this command and specifying "0", the application will not start and it will be the same as stopping. (If you change the number of replicas from "1" to "0", the app will immediately terminate and stop.)

#kubectl scale deployments [Deployment Name] --replicas=0

You can check the number of replicas with the following command

#kubectl get deployments

If you want to restart the stopped app, specify 1 or more with the Scale command.

#kubectl scale deployments [Deployment Name] --replicas=1

Recommended Posts

Stop apps (pods) in Kubernetes
I participated in Kubernetes Internal # 2