Fix Service Not Routing OpenShift¶
Introduction¶
A Service routes traffic to pods selected by labels. If a service has no endpoints, the selector does not match ready pods or the pods are not listening on the target port.
Symptoms¶
Typical symptoms include failed pods, route errors, denied requests, unhealthy operators, or command errors that repeat after retries.
Common Causes¶
- Using labels on the Deployment but not on the pod template.
- Pointing targetPort at the wrong container port.
- Assuming a service works before endpoints exist.
Step 1: Check the Current Status¶
oc get service web -n app
oc describe service web -n app
oc get endpoints web -n app
oc get pods -n app --show-labels
Example output:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
web ClusterIP 172.30.21.144 <none> 8080/TCP 18m
NAME ENDPOINTS AGE
web 10.128.2.14:8080 18m
Step 2: Inspect Logs and Events¶
oc get endpoints web -n app
oc get pods -n app --show-labels
oc exec deploy/web -n app -- ss -lntp
Step 3: Verify Configuration¶
Compare the object selectors, service account, image reference, route target, or operator status with the failing symptom. In OpenShift, events often show the exact admission, scheduling, pull, SCC, or route reason.
Step 4: Apply the Fix¶
Apply the smallest targeted fix: correct the selector, update the route or service port, link the pull secret, grant the specific RBAC or SCC permission, or repair the unhealthy operator dependency.
Step 5: Confirm the Problem Is Resolved¶
Run the verification commands again and confirm the status, events, and user-facing test all agree.
Common Mistakes¶
- Using labels on the Deployment but not on the pod template.
- Pointing targetPort at the wrong container port.
- Assuming a service works before endpoints exist.
Quick Checklist¶
- Confirm the active project.
- Inspect the exact object named in the error.
- Read recent events.
- Apply one focused fix.
- Verify status after the change.
Related Guides¶
Summary¶
Fix Service Not Routing OpenShift requires matching the symptom to the OpenShift object that owns it. Use oc status commands, events, logs, and focused verification so the fix is tied to evidence.