This repository enables Prometheus scraping of dockerhub rate limits by providing a ready to use docker image and helm chart.
You can find more background information in this blog post: https://blog.viadee.de/en/monitoring-the-docker-hub-rate-limit-with-prometheus
Note: The content of this repository is based on the work done by gitlab as described in their blogpost. The original source of the Python script can be found here.
In 0.3.0 the config path for supplying the dockerhub credentials has been changed. If you monitor authenticated requests and you want to update to 0.3.0, then you have to change config.dockerhubUsername
and config.dockerhubPassword
to config.dockerhub.username
and config.dockerhub.password
.
The helm chart can be installed through a helm chart repository hosted on a github page in this repository. To install follow the next steps:
- run
helm repo add viadee https://viadee.github.io/docker-hub-rate-limit-exporter
- run
helm install <release-name> viadee/docker-hub-rate-limit-exporter
If your kubernetes cluster does not authenticate with dockerhub you don't need to do anything here. However, if it does, you need to configure the crendetials with helm values. This is because the docker-hub-rate-limit-exporter does not use the dockerhub account assosiated with the docker context of your kubernetes-cluster. You can configure it to do so by following the steps below:
- Create a helm value file as per the example in this repository (see: chart/values.yaml)
- Fill in the variables
config.dockerhub.username
andconfig.dockerhub.password
. It is recommended to use a dockerhub access token for the password. - Run
helm upgrade <release name> viadee/docker-hub-rate-limit-exporter --install --namespace=<desired namespace> -f <name of value file>
We recommend you to use the Prometheus kubernetes operator to run Prometheus in your cluster (see: https://github.com/prometheus-operator/prometheus-operator). If you run the operator you can create a ServiceMonitor
resource to tell Prometheus how to scrape the docker-hub-rate-limit-exporter. To do so follow the steps below:
- Create a helm value file as per the example in this repository or use the value file from above (see: chart/values.yaml)
- Set the variable
serviceMonitor.enabled
to true - Depending on the configuration of your Prometheus Operator you might need to configure the
serviceMonitor.additionalLabels
section to tell Prometheus to scrape from thisServiceMonitor
resource. - Alternatively, you might have configured the Prometheus Operator to consider all
ServiceMonitors
in a specific namespace. In that case you can set theserviceMonitor.namespace
option to deploy theServiceMonitor
resource in that namespace. - Run
helm upgrade <release name> viadee/docker-hub-rate-limit-exporter --install --namespace=<desired namespace> -f <name of value file>
If you are not using the Prometheus kubernetes operator you would need to configure Prometheus manually to scrape the metrics.
This helm chart was build by viadee Unternehmensberatung AG. If you are interested to find out what else we are doing, check out our website: https://www.viadee.de/en/solutions/cloud
If you have any feedback, ideas or extensions feel free to reach out and create a GitHub issue.