CloudsArk
oc Commands Openshift

oc Get Nodes Examples

Learn practical oc get nodes examples with oc commands, OpenShift manifests, verification steps, common mistakes, and production-focused guidance.

oc Get Nodes Examples

Introduction

Node maintenance in OpenShift uses cordon and drain to move workloads before repair or reboot. Always check DaemonSets, local storage, and PodDisruptionBudgets before draining.

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 nodes
oc adm cordon worker-1
oc adm drain worker-1 --ignore-daemonsets --delete-emptydir-data
oc adm uncordon worker-1

Example output:

node/worker-1 cordoned
node/worker-1 drained
node/worker-1 uncordoned

Verification

oc get nodes
oc get pods -A --field-selector spec.nodeName=worker-1
oc get pdb -A

Common Mistakes

  • Draining without checking PodDisruptionBudgets.
  • Forgetting to uncordon after maintenance.
  • Deleting static or mirror pods manually.

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.

Summary

oc Get Nodes Examples is most useful when paired with verification. Check the project, run the command against the intended object, and confirm the resulting OpenShift state.