Kram is a command-line tool that retrieves resource metrics for Kubernetes namespaces and pods and prints them in a tabular format.
Before using this application, ensure you have the following prerequisites:
- Go installed on your system. (to build)
kubectlconfigured with access to your Kubernetes cluster.- metrics-server deployed in your cluster.
- Clone the repository to your local machine:
git clone https://github.com/PaulPowershell/Kram
cd Kram- Build the Go application:
go build .You can download the executable for Kram directly from the latest release with its version. This allows you to use Kram without the need to build it yourself. Here are the steps to download the executable for your system:
- Visit the Releases page.
Usage:
kram [namespace] [flags]
Flags:
-c, --cpu Show only CPU table (use with -N)
-h, --help help for kram
--kubeconfig string (optional) string Absolute path to the kubeconfig file (default "~/.kube/config")
-N, --node Display resource usage matrix by node
-o, --output string Output format: table or html (default "table")
-r, --ram Show only RAM table (use with -N)To list metrics for all namespaces, run the application without any arguments:
kramThe application outputs (kram) the following metrics in a tabular format:
| Namespace | Pods | CPU Usage | CPU Request | CPU Limit | Mem Usage | Mem Request | Mem Limit |
|---|---|---|---|---|---|---|---|
| example-namespace | 5 | 100 m | 200 m | 300 m | 500 MiB | 600 MiB | 700 MiB |
| another-namespace | 3 | 50 m | 100 m | 150 m | 250 MiB | 300 MiB | 350 MiB |
| Total | 8 | 150 m | 300 m | 350 m | 750 MiB | 900 MiB | 1.05 GiB |
To list metrics for a specific namespace, provide the namespace name as an argument:
kram <namespace>Metrics for Namespace: networking
| Pods | Container | CPU Usage | CPU Request | CPU Limit | Mem Usage | Mem Request | Mem Limit |
|---|---|---|---|---|---|---|---|
| ingress-nginx-controller-xxxxxxxxxx-xxxxx | controller | 2 m | 100 m | 100 m | 62.09MiB | 256MiB | 512MiB |
| ingress-nginx-controller-xxxxxxxxxx-xxxxx | controller | 3 m | 100 m | 100 m | 62.71MiB | 256MiB | 512MiB |
| ingress-nginx-defaultbackend-xxxxxxxxxxxx-xxx | ingress-nginx-default-backend | 1 m | 0 m | 0 m | 4.734MiB | 0B | 0B |
| Total | 6 m | 200 m | 200 m | 129.5MiB | 512MiB | 1GiB |
To list metrics by namespaces on nodes:
kram --nodeMemory Usage / Request / Limit
| Namespace | aks-computespot-xxxxxxxx-xxxxxxxxxx | aks-computespot-xxxxxxxx-xxxxxxxxxx | aks-sys-xxxxxxxx-xxxxxxxxxx |
|---|---|---|---|
| flux-system | - | - | 679.3MiB/400MiB/6.016GiB |
| kube-system | 302.1MiB/446MiB/7.482GiB | 245.9MiB/446MiB/7.482GiB | 518.3MiB/970MiB/13.26GiB |
| monitoring | 256.4MiB/322MiB/1.064GiB | 1.182GiB/1.549GiB/2.799GiB | 172MiB/336MiB/1.123GiB |
| networking | 4.734MiB/0B/0B | - | 125.4MiB/512MiB/1GiB |
| opencost | 108.6MiB/71MiB/272MiB | - | - |
To list metrics for a specific namespace by nodes, provide the namespace name as an argument:
kram <namespace> --nodeMemory Usage / Request / Limit
| Namespace | aks-computespot-xxxxxxxx-xxxxxxxxxx | aks-sys-xxxxxxxx-xxxxxxxxxx |
|---|---|---|
| networking | 4.734MiB/0B/0B | 123.3MiB/512MiB/1GiB |
CPU Usage / Request / Limit
| Namespace | aks-computespot-xxxxxxxx-xxxxxxxxxx | aks-sys-xxxxxxxx-xxxxxxxxxx |
|---|---|---|
| networking | 1m/0m/0m | 5m/200m/200m |
To list ram (or cpu) metrics for a specific namespace by nodes, provide the namespace name as an argument:
kram <namespace> --node --ramMemory Usage / Request / Limit
| Namespace | aks-computespot-xxxxxxxx-xxxxxxxxxx | aks-sys-xxxxxxxx-xxxxxxxxxx |
|---|---|---|
| networking | 4.734MiB/0B/0B | 123.3MiB/512MiB/1GiB |
Any command can be combined with --output html (or -o html) to generate an HTML report and automatically open it in the default browser.
# Node view → kram.html
kram --node --output htmlThe HTML report uses a dark theme and renders the same tables in a responsive, browser-friendly format.
This project is licensed under the MIT License. See the LICENSE file for details.