oc Get Routes Examples¶
Introduction¶
OpenShift Routes publish a Service through the cluster router. Route troubleshooting should confirm the route host, service target, endpoints, TLS termination mode, and router events.
When You Need This Command¶
Use this command when you need to inspect, change, or verify OpenShift resources from the terminal without relying on the web console.
Syntax¶
oc <command> <resource> [name] -n <project>
Practical Examples¶
oc get route web -n app
oc describe route web -n app
oc get service web -n app
oc get endpoints web -n app
curl -Ik https://web-app.apps.ocp.example.com
Example output:
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
web web-app.apps.ocp.example.com web 8080 edge None
Verification¶
oc get route web -n app
oc get endpoints web -n app
curl -Ik https://web-app.apps.ocp.example.com
Common Mistakes¶
- Debugging the route before checking service endpoints.
- Using edge TLS when the backend expects passthrough TLS.
- Forgetting that route hostnames must be unique unless wildcard policy is configured.
Production Notes¶
Run read-only commands first, check the active project, and prefer declarative manifests for repeatable changes.
Example YAML¶
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: web
spec:
host: web-app.apps.ocp.example.com
to:
kind: Service
name: web
port:
targetPort: 8080
tls:
termination: edge
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¶
oc Get Routes Examples is most useful when paired with verification. Check the project, run the command against the intended object, and confirm the resulting OpenShift state.