Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

On this page

Show all

Help Center/ Cloud Container Engine/ FAQs/ Workload/ Container Configuration/ What Is the Retry Mechanism When CCE Fails to Start a Pod?

What Is the Retry Mechanism When CCE Fails to Start a Pod?

Updated on 2024-07-13 GMT+08:00

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

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback