Tonnage is a small utility to summarize the resource capacity and allocation of a Kubernetes cluster. It will inspect pods on a per node basis and then provide both per-node and cluster-wide summary of the resources that are allocatable vs. what has actually been allocated (requests and limits).
This inspection can be cluster wide or you can use label selectors to inspect a subset of nodes, pods, or both.
A particular release:
$ go install github.com/elementalvoid/tonnage.1.00
$ go install github.com/elementalvoid/tonnage
Every release provides binary releases. These can be manually downloaded and installed.
As long as it's in your shell's path you should be able to run it:
tonnage is currently built with the v1.22 Kubernetes client. For a full support matrix please
reference the client-go compatibility chart.
Tonnage accepts a
--context parameter which will cause the client to use the specified "context"
from the kubectl configuration file (
$ tonnage --context=minikube
$ tonnage --context=prod-us-east-1
Label selectors can reduce the inspection to a subset or nodes, pods, or both. This can be handy to summarize tainted nodes, or to see resource consumption from a certain team or set of applications.
From the Kubernetes docs on Labels:
Equality- or inequality-based requirements allow filtering by label keys and values. Matching objects must satisfy all of the specified label constraints, though they may have additional labels as well. Three kinds of operators are admitted =,==,!=. The first two represent equality (and are simply synonyms), while the latter represents inequality. For example:
environment = production tier != frontend
Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:
environment in (production, qa) tier notin (frontend, backend) partition !partition
All pods with the label
Only kube-dns and calico-node pods:
tonnage --pod-selector='k8s-app in (kube-dns, calico-node)'
go test -v ./
golangci-list configuration file is available. Simply run:
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
git checkout -b feature/fooBar)
git commit -am 'Add some fooBar')
git push origin feature/fooBar)