How does container's exit code take effect on the kubernetes cluster

8/28/2017

I'm trying to get to know how container's exit code takes effect on the kubernetes cluster, it would be very appreciated if someone help explain. The scenario as below. I'd like to reduce replicas of service and expect kubernetes deletes the pods which will be graceful shutdown by handling SIGTERM explicitly. But, there is a possibility that container will stop with non-zero exit code. So, My question is will container's non-zero exit code take bad effect on the kubernetes cluster?

Official documentation or source code explanation would be very appreciated.

-- Jeff
docker
kubernetes

1 Answer

8/28/2017

Exit codes will not have any effect on kubernetes cluster. The cluster will keep on working. How will your service behave is a separate story. If a container in your Pod terminates (with whatever exit code) it will be restarted (the container, Pod will not get rescheduled) in most cases (unless we're discussing stuff like Jobs or other things resulting with a non default restart policy)

-- Radek 'Goblin' Pieczonka
Source: StackOverflow