L1 Command Reference (Cheat Sheet)¶
This curated library of oc commands is intended for Level 1 support operations. The focus is on read-only diagnostics, log collection, and safe administrative actions that do not disrupt the production environment.
Cluster Health & Context¶
Commands to identify where you are and the general state of the platform.
| Action | Command |
|---|---|
| Check current user | oc whoami |
| Check API status/version | oc version |
| Check Cluster Operators | oc get co |
| List all nodes | oc get nodes |
| View cluster events | oc get events -A --sort-by='.lastTimestamp' |
Workload Diagnostics (Pods & Deployments)¶
Use these when an application is reported as down or behaving incorrectly.
List all pods in a namespace¶
oc get pods -n <namespace>
# List pods with wide output (IPs and Node names)
oc get pods -n <namespace> -o wide
# Find pods that are NOT in 'Running' state across all namespaces
oc get pods -A --field-selector=status.phase!=Running
# Get full details of a pod (for troubleshooting 'Pending' or 'Evicted')
oc describe pod <pod_name> -n <namespace>
# View logs for a specific container in a pod
oc logs <pod_name> -c <container_name> -n <namespace>
# View logs for a pod that recently crashed
oc logs <pod_name> -n <namespace> --previous
Resource Monitoring¶
Commands to identify resource exhaustion (CPU/Memory) at the pod or node level.
# View resource usage of all nodes
oc adm top nodes
# View resource usage of all pods in a namespace
oc adm top pods -n <namespace>
# Check the Resource Quotas of a namespace
oc get resourcequota -n <namespace>
# Check LimitRanges (default CPU/Mem requests)
oc get limitrange -n <namespace>
Networking & Access¶
Commands to verify connectivity and external access points.
# List all Routes and their associated Hosts/URLs
oc get routes -n <namespace>
# Check Services and their Target Ports
oc get svc -n <namespace>
# Check Endpoints to ensure the Service is linked to active Pods
oc get endpoints <service_name> -n <namespace>
# Test DNS resolution from a debug pod
oc debug node/<node_name> -- chroot /host dig <service>.<namespace>.svc.cluster.local
Storage Operations¶
Commands to verify Persistent Volume Claims.
# Check PVC status (Bound, Pending, Lost)
oc get pvc -n <namespace>
# View details of a Persistent Volume
oc describe pv <pv_name>
# Check available Storage Classes
oc get sc
Safe Maintenance Actions¶
L1-approved actions to resolve minor glitches without reconfiguring the app.
# Restart a Deployment (triggers a rolling update)
oc rollout restart deployment/<deployment_name> -n <namespace>
# Scale a Deployment (e.g., to zero and back to 1 to refresh)
oc scale deployment/<deployment_name> --replicas=0 -n <namespace>
# Copy a file from a pod to your local machine for analysis
oc cp <namespace>/<pod_name>:/path/to/file ./local_file
Pro-Tip: Append -w (watch) to almost any get command to see real-time updates (e.g., oc get pods -w).