To restart a pod in Kubernetes, you typically delete the pod, and the associated controller (like a Deployment) will automatically recreate it. This ensures a fresh start for the pod without downtime for your application. Use the following command to delete a pod:
To restart a pod what we normally do is, to delete it if the pod is part of a workload that takes care or rescheduling that after deletion we spin up a new one. This is not true for standalone pods or for static pods where if you delete it you will need to recreate it manually.
So if your pod is managed by a workload, you can delete it with kubectl :
kubectl delete pod <pod-name>
Alternatively, you can patch the Deployment to trigger a restart by updating an arbitrary annotation, this is much better since it also works for standalone and static pods
kubectl patch deployment <deployment-name> -p '{"spec":{"template":{"metadata":{"annotations":{"kubectl.kubernetes.io/restartedAt":"$(date +"%Y-%m-%dT%H:%M:%SZ")"}}}}}'
This method is preferred for zero-downtime restarts in production environments.