Kubernetes: restart a simple pod

A pod belonging to a deployment can be manually deleted, scaled down, or restarted to get a fresh pod.  However, if all you have is a simple pod definition, these actions are not available.

One way of restarting the pod is to output its full yaml definition and use ‘kubectl replace’ with the force option.

kubectl get pod my-pod -n default -o yaml | kubectl replace --force -f -

 

REFERENCES

kubectl replace – command reference

containiq.com Shingai Zivuku – kubectl to restart pod

github issue, force flag