kubernetesopenshift-3

K8s/Openshift - does the replication controller care about exit status of pod/containers?


The duty of replication controller in K8S/Openshift is to ensure the actual state is same as desired state. So if the desired state is 2 Pods, then it ensures that exactly 2 pods are created/running. If a pod fails for some reason then the replication controller ensures that it will restart a new pod to compensate for the failed pod.

A thing i want to confirm, if the Pod/Container exists with an error - then will the replication controller care about the error code and find that the pod is failing due to error and hence decide to not start the pod any further. ?? Please Answer.


Solution

  • A thing i want to confirm, if the Pod/Container exists with an error - then will the replication controller care about the error code and find that the pod is failing due to error and hence decide to not start the pod any further. ??

    Errors can be shown in many different ways:

    Only the last - process exit code is helpful for the ReplicationController (or in newer Kubernetes, the ReplicaSet controller). If the process exit, the Pod is terminated and a new will be created by the controller.

    In addition, to mitigate the other cases, you can implement a LivenessProbe, so that the Pod will be killed in the presence of another kind of error.