Free as in Freedom: Create your repos!
Report Kubernetes cluster and pod resource requests vs usage and generate static HTML
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fabian Dörk 8326b6aa50 Fix clusterrole to permit access to services (#92) 2 weeks ago
chart/kube-resource-report Fix clusterrole to permit access to services (#92) 2 weeks ago
deploy v0.13 1 month ago
kube_resource_report #41 add tooltip (#88) 1 month ago
sample-report refactor to Python package (#25) 1 year ago
tests use pykube-ng (#70) 4 months ago
.gitignore #41 add tooltip (#88) 1 month ago
.travis.yml More tests (#60) 7 months ago
Dockerfile allow custom links e.g. to monitoring tools (#67) 4 months ago
LICENSE add README 1 year ago
Makefile Add some tests (#59) 7 months ago
Pipfile use pykube-ng (#70) 4 months ago
Pipfile.lock update deps 1 month ago
README.rst casing 1 month ago #24 reduce Docker image size 1 year ago
tox.ini Travis CI 1 year ago


Kubernetes Resource Report

.. image::
:alt: Travis CI Build Status

.. image::;_=1
:alt: Code Coverage

.. image::
:alt: Docker pulls

**This version only supports node costs for AWS EC2 (all regions, On Demand, Linux)**

Script to generate a HTML report of CPU/memory requests vs. usage (collected via Metrics API/Heapster) for one or more Kubernetes clusters.

Want to see how the report looks? `Check out the sample HTML report! <>`_

What the script does:

* Discover all clusters (either via ``~/.kube/config``, via in-cluster serviceAccount, or via custom Cluster Registry REST endpoint)
* Collect all cluster nodes and their estimated costs (AWS only)
* Collect all pods and use the ``application`` or ``app`` label as application ID
* Get additional information for each app from the application registry (``team_id`` and ``active`` field)
* Group and aggregate resource usage and slack costs per cluster, team and application
* Allow custom links to existing systems (e.g. link to a monitoring dashboard for each cluster)


The usage requires `Pipenv <>`_ (see below for alternative with Docker):

.. code-block::

$ pipenv install && pipenv shell
$ mkdir output
$ python3 -m kube_resource_report output/ # uses clusters defined in ~/.kube/config
$ OAUTH2_ACCESS_TOKENS=read-only=mytok python3 -m kube_resource_report --cluster-registry= output/ # discover clusters via registry
$ OAUTH2_ACCESS_TOKENS=read-only=mytok python3 -m kube_resource_report --cluster-registry= output/ --application-registry= # get team information

The output will be HTML files plus multiple tab-separated files:

Main HTML overview page, links to all other HTML pages.
List of cluster summaries with number of nodes and overall costs.
List of potential savings (CPU/memory slack).
List of ingress host rules (informational).
List of all pods and their CPU/memory requests and usages.

Deploying to Minikube

This will deploy a single pod with kube-resource-report and nginx (to serve the static HTML):

.. code-block::

$ minikube start
$ kubectl apply -f deploy/
$ pod=$(kubectl get pod -l application=kube-resource-report -o jsonpath='{.items[]}')
$ kubectl port-forward $pod 8080:80

Now open http://localhost:8080/ in your browser.

Deploy using Helm Chart

IMPORTANT: Helm is not used by the maintainer of kube-resource-report - the Helm Chart was contributed by `Eriks Zelenka <>`_ and is not officially tested or supported!
This will deploy a single pod with kube-resource-report and nginx (to serve the static HTML):

.. code-block::

$ helm upgrade --install kube-resource-report chart/kube-resource-report
$ helm status kube-resource-report

Use ``helm status`` command to verify deployment and obtain instructions to access ``kube-resource-report``.

Running as Docker container

.. code-block::

$ kubectl proxy & # start proxy to your cluster (e.g. Minikube)
$ # run kube-resource-report and generate static HTML to ./output (this trick does not work with Docker for Mac!)
$ docker run -it --user=$(id -u) --net=host -v $(pwd)/output:/output hjacobs/kube-resource-report:0.10 /output

Application Registry

The optional application registry can provide information per application ID, it needs to have a REST API like:

.. code-block::

$ curl -H 'Authorization: Bearer <mytok>'<application-id>
"team_id": "<team-id>",
"active": true

See the ```` script in the ``sample-report`` folder for an example implementation.

Custom Links

The generated report can be enhanced with custom links to existing systems, e.g. to link to monitoring dashboards or similar.
This currently works for clusters, teams, and applications. Custom links can be specified by providing the ``--links-file`` option which must point to a YAML file
with the links per entity. Example file:

.. code-block:: yaml

- href: "{name}"
title: "Grafana dashboard for cluster {name}"
icon: chart-area
- href: "{id}"
title: "Grafana dashboard for application {id}"
icon: chart-area
- href: "{id}"
title: "Go to detail page of application {id}"
icon: search
- href: "{id}"
title: "Search team {id} on people.mycorp"
icon: search

For available icon names, see the `Font Awesome gallery with free icons <>`_.