💡 Thought of the day: What about the docker pause command in K8S ?

July 06, 2021

I wondered this morning if there is an equivalent of “docker pause” in Kubernetes to pause all processes inside a container?

I searched for a solution on the official tech documentation (https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/) without success.

Kubernetes does not support this feature because it only works on virtual machines and K8S advises using stateless pods.

You can all the same patch the readiness in a deployment to determine when the traffic will be able to pass but this could complicate the solution and also restart the container…

An acceptable workaround is to scale down the related deployment, but it is not exactly the same thing: the replicas=0 destroy all the pods, so it is not really a pause!

    kubectl scale --replicas=0 deployment/<pod name> --namespace=<namespace>

Profile picture

Words by Sylvain MARTIN an experienced developer living in Nantes in France. I am passionnate of innovation and WEB technologies. You should follow me on Twitter