feat: add kube-metrics plugin (#3433)

Signed-off-by: bakito <github@bakito.ch>
mine
Marc Brugger 2025-07-05 18:14:35 +02:00 committed by GitHub
parent 6f1bb1689e
commit 76c7a744d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 42 additions and 21 deletions

View File

@ -5,7 +5,7 @@ K9s plugins extend the tool to provide additional functionality via actions to f
Following is an example of some plugin files in this directory. Other files are not listed in this table.
| Plugin-Name | Description | Available on Views | Shortcut | Kubectl plugin, external dependencies |
|--------------------------------| ---------------------------------------------------------------------------- |-------------------------------------|-----------|---------------------------------------------------------------------------------------|
|--------------------------------|-------------------------------------------------------------------------------------------|-------------------------------------|-----------|---------------------------------------------------------------------------------------|
| ai-incident-investigation.yaml | Run AI investigation on application issues to find the root cause in seconds | all | Shift-h/o | [HolmesGPT](https://github.com/robusta-dev/holmesgpt) |
| argocd.yaml | Perform argocd operation quickly | applications | Shift-r | [ArgoCD](https://argo-cd.readthedocs.io/en/stable/getting_started/) |
| debug-container.yaml | Add [ephemeral debug container](1)<br>([nicolaka/netshoot](2)) | containers | Shift-d | |
@ -16,6 +16,7 @@ Following is an example of some plugin files in this directory. Other files are
| job-suspend.yaml | Suspends a running cronjob | cronjobs | Ctrl-s | |
| k3d-root-shell.yaml | Root shell to k3d container | containers | Shift-s | [jq](https://stedolan.github.io/jq/) |
| keda-toggle.yaml | Enable/disable [keda](3) ScaledObject autoscaler | scaledobjects | Ctrl-N | |
| kube-metrics.yaml | Visualize live pod/node metric graphs (Memory/CPU) | pods/nodes | m | [kube-metics](https://github.com/bakito/kube-metrics) |
| log-stern.yaml | View resource logs using stern | pods | Ctrl-l | |
| log-jq.yaml | View resource logs using jq | pods | Ctrl-j | kubectl-plugins/kubectl-jq |
| log-bunyan.yaml | View pods, service, deployment logs using bunyan | pods, service, deployment | Ctrl-l | [Bunyan](https://www.npmjs.com/package/bunyan) |

20
plugins/kube-metrics.yaml Normal file
View File

@ -0,0 +1,20 @@
# requires 'kube-metrics' cli binary installed to be installed (https://github.com/bakito/kube-metrics)
plugins:
# allows visualizing pod and node metrics
kube-metrics-pod:
shortCut: m
confirm: false
description: "Metrics"
scopes:
- pods
- nodes
command: sh
background: false
args:
- -c
- |
if [ -n "$NAMESPACE" ]; then
kube-metrics pod --namespace=$NAMESPACE $NAME
else
kube-metrics node $NAME
fi