What is the difference between always and on failure for kubernetes restart policy? -


the best source restart policys in kubernetes ahve found this:

http://kubernetes.io/docs/user-guide/pods/multi-container/#restartpolicy

but lists alternatives , not explain them. difference between always , onfailure? mustn't thing fail before can restarted?

always means container restarted if exited 0 exit code (i.e. successfully). useful when don't care why container exited, want make sure running (e.g. web server). default.

onfailure means container restarted if exited non-zero exit code (i.e. went wrong). useful when want accomplish task pod, , ensure completes - if doesn't restarted until does.

never means container not restarted regardless of why exited.

these different restart policies map different controller types can see kubectl run --help:

--restart="always": restart policy pod. legal values [always, onfailure, never]. if set 'always' deployment created pod, if set 'onfailure', job created pod, if set 'never', regular pod created. latter 2 --replicas must 1. default 'always'

and pod user-guide:

replicationcontroller appropriate pods restartpolicy = always. job appropriate pods restartpolicy equal onfailure or never.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -