- Get pods in a default namespace using nodename
oc get pods --field-selector spec.nodeName=master-1 -o wide
- Get pods in all namespaces using nodename
oc get pods --field-selector spec.nodeName=master-1 -A -o wide
- Delete pods in a default namespace using nodename
oc delete pods --field-selector spec.nodeName=master-1 -o wide
- Delete pods in all namespaces using nodename
oc delete pods --field-selector spec.nodeName=master-1 -A -o wide
- Sort pods based on nodename
oc get pods -o wide --sort-by="{.spec.nodeName}"
- Find all pods deployed in master nodes, sort by nodes, remove field-selector.
for node in $(oc get nodes -l node-role.kubernetes.io/master= --no-headers | cut -d " " -f1); do oc get pods --all-namespaces --no-headers --field-selector spec.nodeName=${node} -o wide ; done
Top comments (0)