Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 822
mmiara Avatar asked Mar 03 '23 15:03

mmiara


1 Answers

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.

like image 81
coderanger Avatar answered Mar 26 '23 02:03

coderanger