What Is the Retry Mechanism When CCE Fails to Start a Pod?
CCE is a fully managed Kubernetes service and is fully compatible with Kubernetes APIs and kubectl.
In Kubernetes, the spec of a pod contains a restartPolicy field. The value of restartPolicy can be Always, OnFailure, or Never. The default value is Always.
- Always: When a container fails, kubelet automatically restarts the container.
- OnFailure: When a container stops running and the exit code is not 0 (indicating normal exit), kubelet automatically restarts the container.
- Never: kubelet does not restart the container regardless of the container running status.
restartPolicy applies to all containers in a pod.
restartPolicy only refers to restarts of the containers by kubelet on the same node. When containers in a pod exit, kubelet restarts them with an exponential back-off delay (10s, 20s, 40s, …), which is capped at five minutes. Once a container has been running for 10 minutes without any problems, kubelet resets the restart backoff timer for the container.
The settings of restartPolicy vary depending on the controller:
- Replication Controller (RC) and DaemonSet: restartPolicy must be set to Always to ensure continuous running of the containers.
- Job: restartPolicy must be set to OnFailure or Never to ensure that containers are not restarted after being executed.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot