Restart all k8s pods in cluster?

4/2/2020

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?

-- mm_wvu18
cron
kubernetes
load-balancing
pod

1 Answer

4/3/2020

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.

-- coderanger
Source: StackOverflow