Kubernetes doesn't support stopping/pausing the current state of Pods. However, you can perform a rollout restart of the Deployment
/DaemonSet
with the kubectl rollout restart
command (see: the Kubectl Reference Docs).
To restart all Deployments
and DaemonSets
in the kube-system
namespace, you can use the following command:
# kubectl -n kube-system rollout restart daemonsets,deployments
daemonset.apps/calico-node restarted
deployment.apps/local-path-provisioner restarted
deployment.apps/coredns restarted
deployment.apps/metrics-server restarted
deployment.apps/calico-kube-controllers restarted
As you probably noticed from the output above, the calico-node
is a DaemonSet
and rest of the Pods are managed by Deployments
.
If you want, you can restart specific Deployment
/Daemonset
:
# kubectl -n kube-system rollout restart deployment metrics-server
deployment.apps/metrics-server restarted
# kubectl get pod -n kube-system | grep metrics-server
metrics-server-6bd8786b6c-74qlt 1/1 Running 0 2s
metrics-server-647d5b4475-ch9zj 1/1 Terminating 0 28s