OpenShift Service Explained¶
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.
When You Need This¶
Use this when traffic does not reach an OpenShift application, TLS behavior is unclear, DNS fails inside the cluster, or NetworkPolicy changes affect pod communication.
Key Objects and Commands¶
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-by-Step Configuration¶
- Confirm the project and object names.
- Check route, service, endpoint, pod, and policy status.
- Apply only the network change that matches the failed layer.
Verification¶
oc get endpoints web -n app
oc get pods -n app --show-labels
oc exec deploy/web -n app -- ss -lntp
Troubleshooting¶
Follow the path from client to route, route to service, service to endpoint, endpoint to pod, and pod to container port.
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¶
OpenShift Service Explained is easier to troubleshoot when each network layer is verified separately instead of treating every failure as a router problem.