Open
Description
What would you like to be added:
I would like to be able to see resource consumption for all pods running on the specific node only.
kubectl top pods --field-selector spec.nodeName=<name>
Currently this command is failing with:
➜ ~ kubectl top pods --field-selector spec.nodeName=<node> -A
Error from server (BadRequest): "spec.nodeName" is not a known field selector: only "metadata.name", "metadata.namespace"
Why is this needed:
This is useful when investigating node resource pressure. Let's say that I run kubectl top nodes --sort-by='memory'
and see that one of my nodes is on 95% memory usage. The next logical thing to do is to find what are the most memory intensive pods.
I can run kubectl describe node <name>
, this will give me list of pods and their memory requests and limits but not the usage.
Currently this can be fetched by the following overly-complicated command:
kubectl get pods --field-selector spec.nodeName='<name>' -A -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name --no-headers | \
xargs -I {} sh -c "kubectl top pod --no-headers -n {}" | \
column -t
Related issues:
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Needs Triage