oc Get Pods Examples¶
Introduction¶
oc get pods gives the quickest view of application health in a project. Use wide output and labels when you need node placement or selector information.
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 pods -n app
oc get pods -n app -o wide
oc get pods -n app --show-labels
oc get pods -n app -l app=web
Example output:
NAME READY STATUS RESTARTS AGE IP NODE
web-7c9d7f6f8b-jx4mk 1/1 Running 0 6m 10.128.2.14 worker-1
web-7c9d7f6f8b-r2q9p 1/1 Running 0 6m 10.129.1.20 worker-2
Verification¶
oc get events -n app --sort-by=.lastTimestamp
oc get pods -n app -o wide
Common Mistakes¶
- Looking only at the final error and ignoring events.
- Checking the wrong project with oc.
- Changing several objects at once before confirming the current state.
Production Notes¶
Run read-only commands first, check the active project, and prefer declarative manifests for repeatable changes.
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 Pods Examples is most useful when paired with verification. Check the project, run the command against the intended object, and confirm the resulting OpenShift state.