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.
Container Configuration FAQs
- When Is Pre-stop Processing Used?
- How Do I Set an FQDN for Accessing a Specified Container in the Same Namespace?
- What Should I Do If Health Check Probes Occasionally Fail?
- How Do I Set the umask Value for a Container?
- What Can I Do If an Error Is Reported When a Deployed Container Is Started After the JVM Startup Heap Memory Parameter Is Specified for ENTRYPOINT in Dockerfile?
- What Is the Retry Mechanism When CCE Fails to Start a Pod?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
more