Why is my deployment failing?
It could happen because of a number of reasons. Here are some hints to get you started:
-
Check if the application pods are created:
If you deployment is named myapp, then there should be at least one pod named myapp-N-XXXXX, where N is the number of the deployment, and XXXXX is a random unique identifier.
If the application pods are not there, then there is either a misconfiguration in your DeploymentConfig, or you might have hit a quota. Check out the Quota and Events menus in the admin console for more hints.
-
Check the status of the application pods:
If the application pod’s status is not Running, that is usually either a misconfiguration in the DeploymentConfig: e.g., the image specified does not exist, invalid volume specification, etc., or the application image itself is erroneous, and the application can’t start because of that.
Check the Logs of the pod first: if the problem is within the application image, you will usually find a hint there.
Then check the Events tab under the pod. If there is a misconfiguration, you will definitely find some clues there about what went wrong.
Why does not my Pod start?
See Why is my deployment failing? above.
How can I restart a Pod?
The lifecycle of a pod does not include restarting, in other words: there is no such thing as restarting a pod.
If you want to achieve the same effect however, you can either delete the pod, or scale your deployment down to zero, and then scale it back up again to the desired number. The deployment that manages the pods will automatically create new pods in case a pod goes missing: so deleting a pod will generally have the same effect as restarting.
However, you should consider defining health checks (readiness probes and liveness probes) for your applications which can monitor your pods, and automatically restart the containers within the pod in case the application becomes unhealthy.
For more information about health checks, see the OpenShift documentation.
How can I run images from the public Docker Hub?
To deploy an application based on an image from the public Docker Hub:
-
Log in to the web console
-
Select a project, then click on Add to Project
-
Select Deploy Image
-
Select Image Name
-
Enter the image name the same way you would specify it for the
docker pull
command, and hit enter or click on the search icon.
PodSpace will look up the specified image on Docker Hub, and you will be able to deploy the image if the lookup was successful. A form will be displayed, where you will have the option to specify the deployment name and set environment variables.
How can I deploy images from an external registry that needs authentication?
To deploy an image from a private external registry, you have to add an Image Pull Secret to your deployment config.
In order to do that, you must follow the steps described in How can I run images from the public Docker Hub? above, and also click on the Create new secret link in the form that appears after you have entered the image name under the Deploy Image option.
You must provide the full name of the image, including the repository. So if you deploy an image from the Docker Hub, you should write docker.io/myrepo/myimage:latest instead of just writing myrepo/myimage:latest. |
After you have clicked on Create new secret a dialog appears where you can enter your registry credentials. Click on Create after completing the form, and then proceed with deploying the image by clicking Create again at the bottom of the page.