Forum Navigation
You need to log in to create posts and topics.

Restart Pod inside Kubernetes Container

Problem

User wants to restart pod without reseting to default pods settings. for example making changes that requires reload for several applications inside the pods

Solution

You can use some commands available inside the pods to restart it

kubectl exec POD_NAME -c CONTAINER_NAME /sbin/killall5

kubectl exec -it [POD_NAME] -c [CONTAINER_NAME] — /bin/sh -c “kill 1”

kubectl exec -it [POD_NAME] -c [CONTAINER_NAME] — /bin/sh -c “/sbin/reboot”

Example

kubectl exec prom-operator-grafana-6848c59c99-zn7hq -c grafana /sbin/reboot -n monitoring