[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: What if a container dies in OpenShift?



[bringing the openshift-users mailing list back]


On Wed, Nov 25, 2015 at 3:04 PM, Den Cowboy <dencowboy hotmail com> wrote:
Thanks, that's very clear but do you have to configure it manually? I just killed a container and it was recreated but also killed instantly.
Error of the container:
[centos ip-10-0-0-xx ~]$ docker logs b24008661dc1
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.1.0.x. Set the 'ServerName' directive globally to suppress this message



Since the default is "Always", you might not need to change it. If your pods/containers started normally to a working state, that's just fine.
Upon an unexpected crash the restart policy will take care of bringing your container back to life.

However, when you have containers that die and get restarted too often, that probably indicates an error that you want to debug and fix.

The fix depends on what image you are running.





 



From: rcarvalh redhat com
Date: Wed, 25 Nov 2015 14:50:58 +0100
Subject: Re: What if a container dies in OpenShift?
To: dencowboy hotmail com
CC: users lists openshift redhat com

On Wed, Nov 25, 2015 at 2:23 PM, Den Cowboy <dencowboy hotmail com> wrote:
Hmm, okay so restartpolicty will be set 'always'. And when it's 'always' it will be defined by the replication controller. But the RC is only working on pod-level. So new pods will be recreated thanks to the RC. But the RC describes nothing about containers? So when A pod is still running but the container in it is dead, than there will happen nothing?

I'm sorry, I'm probably wrong but I do not understand it at the moment.
Thanks


By default the restartpolicy is set to always. That applies to both pods and their containers.
Maybe I'll illustrate with an example I just ran locally:


[vagrant openshiftdev ~]$ oc project default
Now using project "default" on server "https://10.0.2.15:8443".
[vagrant openshiftdev ~]$ oc get pods
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-mqqmk   1/1       Running   0          33s
[vagrant openshiftdev ~]$ docker ps | grep registry
ef318d7839f8        openshift/origin-docker-registry:v1.1   "/bin/sh -c 'REGISTRY"   49 seconds ago      Up 48 seconds                           k8s_registry.ea5217cb_docker-registry-1-mqqmk_default_64a5c92c-937a-11e5-b5a1-080027c5bfa9_18eb84e5
65e675979b64        openshift/origin-pod:v1.1               "/pod"                   50 seconds ago      Up 49 seconds                           k8s_POD.cc3ffd58_docker-registry-1-mqqmk_default_64a5c92c-937a-11e5-b5a1-080027c5bfa9_21e3cc20
[vagrant openshiftdev ~]$ docker kill ef318d7839f8
ef318d7839f8
[vagrant openshiftdev ~]$ oc get pods
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-mqqmk   1/1       Running   1          1m
[vagrant openshiftdev ~]$ docker ps | grep registry
fd08b9cdfd90        openshift/origin-docker-registry:v1.1   "/bin/sh -c 'REGISTRY"   15 seconds ago      Up 13 seconds                           k8s_registry.ea5217cb_docker-registry-1-mqqmk_default_64a5c92c-937a-11e5-b5a1-080027c5bfa9_0ab0a013
65e675979b64        openshift/origin-pod:v1.1               "/pod"                   2 minutes ago       Up About a minute                       k8s_POD.cc3ffd58_docker-registry-1-mqqmk_default_64a5c92c-937a-11e5-b5a1-080027c5bfa9_21e3cc20



I killed a container that was running my registry, and the container was restarted. Note that the container name changed, but the pod did not change.


I don't know for sure about the implementation, but since Docker 1.2 there's an option to configure container restart policy.

It's either that, or the statement "the RC is only working on pod-level" is not entirely true.

Either way, you have a guarantee that pod and container restarts obey the same policy, set on the pod level.


HTH,

--
Rodolfo Carvalho

OpenShift Developer Experience



--
Rodolfo Carvalho

OpenShift Developer Experience

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]