Restart container within pod

前端 未结 9 1109
日久生厌
日久生厌 2020-12-04 07:04

I have a pod test-1495806908-xn5jn with 2 containers. I\'d like to restart one of them called container-test. Is it possible to restart a single co

9条回答
  •  清歌不尽
    2020-12-04 07:26

    Is it possible to restart a single container

    Not through kubectl, although depending on the setup of your cluster you can "cheat" and docker kill the-sha-goes-here, which will cause kubelet to restart the "failed" container (assuming, of course, the restart policy for the Pod says that is what it should do)

    how do I restart the pod

    That depends on how the Pod was created, but based on the Pod name you provided, it appears to be under the oversight of a ReplicaSet, so you can just kubectl delete pod test-1495806908-xn5jn and kubernetes will create a new one in its place (the new Pod will have a different name, so do not expect kubectl get pods to return test-1495806908-xn5jn ever again)

提交回复
热议问题