Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restarting a specific pod inside a Deployment

Tags:

kubernetes

I want to restart a pod (that is part of a deployment), without having to restart/replace the entire deployment.

I have tried kubectl replace --force -f file.yaml but that restarts the whole deployment. I want to just restart the current pod that is live.

Any thoughts are appreciated.

like image 720
Ramboo19 Avatar asked Feb 21 '18 11:02

Ramboo19


Video Answer


1 Answers

Why not just kubectl delete pod <pod> ? It will remove your single pod and schedule new in it's place.

If rescheduling is a problem, you could try to kill the process running inside the container in pod with something like kubectl exec <pod> <container> kill 1, but some processes might not be willing to surrender easily :)

like image 93
Radek 'Goblin' Pieczonka Avatar answered Sep 22 '22 14:09

Radek 'Goblin' Pieczonka