Skip to content

add NODE info for kubectl top pod output #1706

@qyecst

Description

@qyecst

What would you like to be added:

Hi team, I want to add NODE info for kubectl top pod output like

NAME                   NODE     CPU(cores)   MEMORY(bytes)   
db-5977df8496-p8s2f    node1    1m           57Mi
one-d48cbd8b8-znqcx    node2    2m           1Mi
two-55445bbdb9-bt72c   node3    5m           2Mi

Why is this needed:
Convenient to view the pod status of the specified node: kubectl top pod |grep node-name

Convenient to check the load and node distribution of pods: kubectl top pod -l app=label

When sudden surge in node load, convenient to check the status of the corresponding pods.


The current output does not include node information. When we need to handle high-load pods or pods on high-load nodes, we need to use the kubectl get command to obtain the node where the pod is located.

This involves many additional commands and operations, such as handling and merging information from get pod and get podmetrics.

Using Prometheus for information aggregation is a solution, but it still takes a lot of time to pass pod names between Prometheus and the terminal when you need to operate on pods, especially when there are many pods involved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.sig/cliCategorizes an issue or PR as relevant to SIG CLI.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions