Skip to main content

kube-cargo-load

PyPI Python Versions License

List Kubernetes PODs of a specific namespace or all namespaces with their configured memory or cpu requests, limits and the current memory or cpu usage.

Features

  • Overview of PODs and their memory or cpu requests, limits and actual usage
  • Provides an easy inspection of the cluster utilization in terms of memory or cpu
  • Uses kubectl under the hood and reuses its config
  • Supports --namespace and --all-namespaces command line arguments
  • Supports --context command line argument filters and column setup

Example:

[15:09:58] enrico@host (0): ~% kubecargoload.py --all-namespaces
Namespace   Name                                          Requests       Limits        Usage            %
----------------------------------------------------------------------------------------------------------
default     kube-web-view-7c67ddb647-pvjvs                100.0 Mi     100.0 Mi      29.0 Mi      29.00 %
jitsi       jitsi-57d5888c88-vzrzl                          0.0  B       0.0  B     137.0 Mi       0.00 %
kube-system coredns-66bff467f8-qn4pq                       70.0 Mi     170.0 Mi      13.0 Mi       7.65 %
kube-system coredns-66bff467f8-znpxv                       70.0 Mi     170.0 Mi      11.0 Mi       6.47 %
kube-system etcd-minikube                                   0.0  B       0.0  B      58.0 Mi       0.00 %
kube-system kindnet-ptgnz                                  50.0 Mi      50.0 Mi      13.0 Mi      26.00 %
kube-system kube-apiserver-minikube                         0.0  B       0.0  B     257.0 Mi       0.00 %
kube-system kube-controller-manager-minikube                0.0  B       0.0  B      50.0 Mi       0.00 %
kube-system kube-proxy-s7bl8                                0.0  B       0.0  B      16.0 Mi       0.00 %
kube-system kube-scheduler-minikube                         0.0  B       0.0  B      19.0 Mi       0.00 %
kube-system metrics-server-7bc6d75975-d6sgr                 0.0  B       0.0  B      13.0 Mi       0.00 %
kube-system nginx-ingress-controller-6d57c87cb9-tgwwm       0.0  B       0.0  B       0.0  B       0.00 %
kube-system storage-provisioner                             0.0  B       0.0  B      15.0 Mi       0.00 %
----------------------------------------------------------------------------------------------------------
Summary     (PODs without configured limits ignored)      290.0 Mi     490.0 Mi      66.0 Mi      13.47 %

Setup

Requirements

In order to use kube-cargo-load, you will need:

Installation

The easiest method is to install directly from pypi using pip:

pip install kube-cargo-load

If you prefer, you can download kube-cargo-load and install it directly from source:

python setup.py install

Download

Alternatively, you can download just the script and execute it:

wget https://raw.githubusercontent.com/eht16/kube-cargo-load/master/kubecargoload.py
chmod +x kubecargoload.py
./kubecargoload.py

Command line options

usage: kubecargoload.py [-h] [-A] [--context CONTEXT] [-d] [-n NAMESPACE] [-H] [-s SORT] [-V]

optional arguments:
  -h, --help            show this help message and exit
  -A, --all-namespaces  list the requested object(s) across all namespaces (default: False)
  -c, --cpu             show cpu instead of memory (default: False)
  --context CONTEXT     the name of the kubeconfig context to use (default: None)
  -d, --debug           enable tracebacks (default: False)
  -n NAMESPACE, --namespace NAMESPACE
                        namespace to use (default: default)
  -H, --no-headers      do not print header line before the output (default: False)
  -s SORT, --sort SORT  sort by column(s), to sort by multiple columns seperate them with comma. Valid options: namespace,name,requests,limits,usage,ratio (default: namespace,name)
  -V, --version         show version and exit (default: False)

Get the Source

The source code is available at https://github.com/eht16/kube-cargo-load/.

ChangeLog

1.2 / 2020-05-24

* Add support for -c/--cpu flag (#3, Kurounin)
* Round humanized usage values to have more accurate numbers
* Add unit tests

1.1 / 2020-04-15

* Fix Python 3.6 compability (#1, Adrian Gajan)
* Improve docs
* Fix display units (KB -> Ki)
* Consider only PODs with configured limits in the summary

1.0 / 2020-04-12

* Initial release

Contributing

Found a bug or got a feature request? Please report it at https://github.com/eht16/kube-cargo-load/issues.

Author

Enrico Tröger enrico.troeger@uvena.de

Metadata

Release files for kube-cargo-load 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kube-cargo-load 1.2
File Size Uploaded
kube-cargo-load-1.2.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kube-cargo-load 1.2
File Interpreter ABI Platform
kube_cargo_load-1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 24.0 kB

Release files / kube-cargo-load-1.2.tar.gz

Download URL kube-cargo-load-1.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
342a16a4a61dc76c42e386b8953ffd957dc97e88fd0979b49fc4009b15bf5fab
BLAKE2b-256 checksum
How to use checksums
1be0b7f8366837fe36f955223af3b54c7d27a454fa4c8624dc5f08d8bb9ec073
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Release files / kube_cargo_load-1.2-py2.py3-none-any.whl

Download URL kube_cargo_load-1.2-py2.py3-none-any.whl
Size 11.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
47255b8c77eacc0e8648a8aca3a03c1b7f2d9d12665cd66fe023e1aba84a8a0d
BLAKE2b-256 checksum
How to use checksums
42a9ca905263044fc814d21d5ced5d123c85936c00e4d601d101b5f8cc22acfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page