IBM Cloud Private · kubernetes · linux

kubernetes: restarting failing Pods

To reboot all your failing Pods you can execute the following command:

FAILING_PODS=($(kubectl get pods -n kube-system | grep 0/ | awk '{print $1}')) && for i in "${FAILING_PODS[@]}"; do kubectl get pod $i -n kube-system -o yaml | kubectl replace --force -f -; done

p.s: ensure you have successfuly authenticated in your cluster before executing it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s