ECHOKE
Guides

Node based Pod Metrics - Kubenpod

Engin Can Höke
#kubernetes#monitoring#tools

Kubenpod is a tool designed to simplify listing and monitoring pods operating on a specific node within a Kubernetes cluster. You can utilize it by specifying a node name or a pod name, as demonstrated in the examples below. If you encounter any issues or have suggestions, feel free to leave a comment.

Installation

To install Kubenpod, execute the following commands in your terminal:

sudo curl -LO https://raw.githubusercontent.com/ehok/toppod/master/kubenpod > kubenpod
sudo chmod +x kubenpod
sudo mv kubenpod /usr/local/bin/kubenpod

Usage

After installation, you can use the following commands:

$ kubenpod --help
USAGE:
  kubenpod <NODE_NAME>                 : show metrics of all pods of the <NODE_NAME>
  kubenpod -p <POD_NAME>               : show metrics of pods of the <POD_NAME>'s node 
  kubenpod                             : show this message
  kubenpod -h,--help                   : show this message
  kubenpod -l,--list <NODE_NAME>       : list all pods of the <NODE_NAME>
  kubenpod -lp,--listpod <POD_NAME>    : list all pods of the <POD_NAME>'s node

Examples

To display metrics for all pods on a specific node:

$ kubenpod ip-10-0-0-1.us-east-1.compute.internal
hoke              hoke-deployment-cda628x58-p1vzz                                   176m   267Mi
kube-system       aws-node-r6n1m                                                    3m     28Mi
kube-system       coredns-165c7a19dd-st08z                                          3m     20Mi
kube-system       kube-proxy-ty1m6                                                  1m     14Mi
kube-system       spot-interrupt-handler-f7syd                                      2m     4Mi
monitoring        prometheus-node-exporter-d91th                                    2m     9Mi
nginx-ingress     nginx-ingress-controller-vqf8q                                    36m    151Mi

To show metrics of the node where a specific pod is running:

$ kubenpod -p hoke-deployment-cda628x58-p1vzz
hoke              hoke-deployment-cda628x58-p1vzz                                   176m   267Mi
kube-system       aws-node-r6n1m                                                    3m     28Mi
kube-system       coredns-165c7a19dd-st08z                                          3m     20Mi
kube-system       kube-proxy-ty1m6                                                  1m     14Mi
kube-system       spot-interrupt-handler-f7syd                                      2m     4Mi
monitoring        prometheus-node-exporter-d91th                                    2m     9Mi
nginx-ingress     nginx-ingress-controller-vqf8q                                    36m    151Mi

To list all pods on a specific node:

$ kubenpod -l ip-10-0-0-1.us-east-1.compute.internal
hoke              hoke-deployment-cda628x58-p1vzz           1/1   Running     0      6d3h
kube-system       aws-node-r6n1m                            1/1   Running     0      58d
kube-system       coredns-165c7a19dd-st08z                  1/1   Running     0      56d
kube-system       kube-proxy-ty1m6                          1/1   Running     0      26d
kube-system       spot-interrupt-handler-f7syd              1/1   Running     0      5d22h
monitoring        prometheus-node-exporter-d91th            1/1   Running     0      58d
nginx-ingress     nginx-ingress-controller-vqf8q            1/1   Running     0      58d

To list all pods on the node where a specific pod is running:

$ kubenpod -lp hoke-deployment-cda628x58-p1vzz
hoke              hoke-deployment-cda628x58-p1vzz           1/1   Running     0      6d3h
kube-system       aws-node-r6n1m                            1/1   Running     0      58d
kube-system       coredns-165c7a19dd-st08z                  1/1   Running     0      56d
kube-system       kube-proxy-ty1m6                          1/1   Running     0      26d
kube-system       spot-interrupt-handler-f7syd              1/1   Running     0      5d22h
monitoring        prometheus-node-exporter-d91th            1/1   Running     0      58d
nginx-ingress     nginx-ingress-controller-vqf8q            1/1   Running     0      58d

For more information and updates, visit the Kubenpod GitHub repository.

← Blog'a Dön