What is CrashLoopBackOff status for openshift pods?

ZeroGraviti picture ZeroGraviti · Feb 29, 2016 · Viewed 18.4k times · Source

There is more than one example where I have seen this status from a pod running in openshift origin. In this case it was the quickstart for the cdi camel example. I was able to successfully build and run it locally (non - openshift) but when I try to deploy on my local openshift (using mvn -Pf8-local-deploy), I get this output for that particular example (snipped for relevance) :-

[vagrant@vagrant camel]$ oc get pods NAME READY STATUS RESTARTS AGE cdi-camel-z4czs 0/1 CrashLoopBackOff 4 2m

Tail of the logs are as under:-

  Error occurred during initialization of VM
  Error opening zip file or JAR manifest missing : agents/jolokia.jar
  agent library failed to init: instrument

Can someone help me solve this ?

Answer

Graham Dumpleton picture Graham Dumpleton · Mar 1, 2016

If the state of the pod goes in to CrashLoopBackOff it usually indicates that the application within the container is failing to start up properly and the container is exiting straight away as a result.

If you use oc logs on the pod name, you may not see anything useful though as it would capture what the latest attempt to start it up is doing and may miss messages.

What you should do is instead provide the --previous or -p option to oc logs along with the pod name. That will show you the complete logs from the previous attempt to start up the container.

If this is an arbitrary Docker image you are using, a common problem that can occur and which would cause the container not to start, is an application image which requires to be run as the root user. Because running an application inside of a container as root still has risks, OpenShift doesn't allow you to do that by default and will instead run as an arbitrary assigned user ID. The application image may not be designed with this possibility in mind and so is failing.

So try and get those logs messages and see what the problem is.