According to the docs -
Failed containers that are restarted by Kubelet, are restarted with an exponential back-off delay, the delay is in multiples of sync-frequency 0, 1x, 2x, 4x, 8x … capped at 5 minutes and is reset after 10 minutes of successful execution.
Is there any way to define a custom RestartPolicy? I want to minimize the back-off delay as much as possible and drop off the exponential behavior.
As far as I can find, you can't even configure the RestartPoilcy, let alone make a new one...
Once you created the pod, kubernetes makes some properties immutable. These are mostly the options which can change pods stability, for example this. You can get the manifest using kubectl get pod $PODNAME -o yaml --export . Then edit this manifest and change the restartPolicy field to Never and redeploy it.
restartPolicy only refers to restarts of the containers by the kubelet on the same node. After containers in a Pod exit, the kubelet restarts them with an exponential back-off delay (10s, 20s, 40s, …), that is capped at five minutes.
In Kubernetes, Always is the default restart policy. With this policy, containers will always be restarted if they stop, even if they completed successfully. This policy should be used for applications that always needs to be running.
The backoff delay is not tunable because it could severely affects the reliability of kubelet. Imagine you have some pods that keep crashing on the node, kubelet will continuously restarting all those pods/containers with no break, consuming a lot of resources.
Why do you want to change the restart backoff delay?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With