Search code examples
kubernetescronload-balancing

Restart all k8s pods in cluster?


What is the best way to restart all pods in a cluster? I was thinking that setting a cronjob task within kubernetes to do this on a normal basis and make sure that the cluster is load balanced evenly, but what is the best practice to do this on a normal basis? Also, what is the best way to do this as a one-time task?


Solution

  • This is a bad idea. Check out https://github.com/kubernetes-sigs/descheduler instead to do it selectively and with actual analysis :)

    But that said, kubectl delete pod --all --all-namespaces or similar.