Debugging app deployments
Virtual Private Cloud Classic infrastructure
Review the options that you have to debug your app deployments and find the root causes for failures.
Before you begin, ensure you have the Writer or Manager IBM Cloud IAM service access role for the namespace where your app is deployed.
-
Make sure that you review the common scenarios where you might need to modify your apps so that you can deploy them on Red Hat OpenShift clusters.
-
Look for abnormalities in the service or deployment resources by running the
describe
command.oc describe service <service_name>
-
Check whether the containers are stuck in the
ContainerCreating
state. -
Check whether the cluster is in the
Critical
state. If the cluster is in aCritical
state, check the firewall rules and verify that the master can communicate with the worker nodes. -
Verify that the service is listening on the correct port.
- Get the name of a pod.
oc get pods
- Log in to a container.
oc exec -it <pod_name> -- /bin/bash
- Curl the app from within the container. If the port is not accessible, the service might not be listening on the correct port or the app might have issues. Update the configuration file for the service with the correct port and redeploy
or investigate potential issues with the app.
curl localhost: <port>
- Get the name of a pod.
-
Verify that the service is linked correctly to the pods.
- Get the name of a pod.
oc get pods
- Log in to a container.
oc exec -it <pod_name> -- /bin/bash
- Curl the cluster IP address and port of the service.
curl <cluster_IP>:<port>
- If the IP address and port are not accessible, look at the endpoints for the service.
- If no endpoints are listed, then the selector for the service does not match the pods. For example, your app deployment might have the label
app=foo
, but the service might have the selectorrun=foo
. - If endpoints are listed, then look at the target port field on the service and make sure that the target port is the same as what is being used for the pods. For example, your app might listen on port 9080, but the service might listen on port 80.
- If no endpoints are listed, then the selector for the service does not match the pods. For example, your app deployment might have the label
- Get the name of a pod.
-
For Ingress services, verify that the service is accessible from within the cluster.
- Get the name of a pod.
oc get pods
- Log in to a container.
oc exec -it <pod_name> -- /bin/bash
- Curl the URL specified for the Ingress service. If the URL is not accessible, check for a firewall issue between the cluster and the external endpoint.
curl <host_name>.<domain>
- Get the name of a pod.