Helm Chart Prometheus Exporter

Ever wanted to know what versions of software are running on your Kubernetes cluster? Now, assuming you’re using Helm to install everything, you can.

Install the kubedex-exporter on your cluster, and if you have Prometheus already setup, you’ll start receiving metrics.

Ultimately, you will end up with a table like this on your Grafana dashboard. This table will dynamically update as you add and remove helm charts or upgrade versions. Many companies are moving towards using Helm for packaging up their micro-services so this chart should help confirm what versions of services are running where.

 

Full Tutorial

Maybe you want to test this out first. Or, perhaps you want to learn more about Prometheus. Here’s a step by step guide to setting up Prometheus on minikube locally. Then we’ll show you how to install the kubedex-exporter helm chart and setup the dashboard.

1. Install minikube

You can find the installation instructions here: https://kubernetes.io/docs/tasks/tools/install-minikube/

I’d recommend installing VirtualBox if you’re trying this out on OSX.

Once you’ve installed minikube you can start a new cluster with rbac support.

 

Now you have a local Kubernetes cluster running on version 1.10. Time to setup some applications to run on it.

2. Install helm

Follow the instructions here: https://docs.helm.sh/using_helm/#installing-helm

We’ll use Helm to install Prometheus, Grafana and Kubedex-Exporter charts.

3. Install Prometheus

We’re just doing a demo here so we’ll install Prometheus into its own namespace and disable persistent volumes. If you’re doing this for real in future you’ll want to configure proper storage so you don’t lose all of the data when the containers restart.

 

Once Prometheus is installed let’s check the targets are all up and green. Open a port to the Prometheus instance so you can see the targets page in the UI.

 

Now open a browser to http://localhost:9090/graph

Everything should be up and green.

Now lets install the Kubedex-exporter and see if it pops up in this target list.

4. Install Kubedex Exporter

Add the kubedex chart repository and install the chart as follows.

 

This will start a pod in the default namespace. You can also specify –namespace whatever on the helm install line to put it somewhere else.

Now lets have a look at the targets page again and confirm that the kubedex exporter is being scraped.

I added the red box around the part you’re looking for.  You should see a pod being scraped on port 9484 and the state should be up. You may need to manually refresh the targets page to get this to show up.

5. Install Grafana

Now you have metrics coming in you’ll want to see pretty graphs. Setting up Grafana is another simple helm command.

 

Once installed grab the password from the secrets store so you can login.

 

Then open a port to the Grafana web UI.

 

Now open a browser to http://localhost:3000

Login with username admin and the password you got from above. Once logged in we’ll need to setup a data source to Prometheus.

We need to tell Grafana how to connect to the Prometheus server instance so lets find out the endpoint.

 

In our case we’re looking at the bottom endpoint that ends prometheus-server and listens on port 9090.

Copy and paste that into the Grafana data source. Here’s what my one looks like:

On a proper cluster you’d have DNS setup properly and use a better URL.

6. Setup some dashboards

As you saw from above you get quite a lot of default targets when you install Prometheus. Importing dashboards is quite simple. From the top dropdown menu click ‘import dashboard’. Then paste in this dashboard reference: 6417

You should see a nice pretty dashboard.

Not bad for a few commands and 5 minutes work. Lets make our own dashboard next and select the table panel so we can display our kubedex-exporter Helm chart versions.

In the table panel properties use this query.

You can see the metric is called helm_chart_info and we’re getting the name and version labels.

For those who prefer to copy and paste here’s the query.

 

Be sure to tick the instant checkbox at the bottom right. You’ll also need to go into the Column Styles tab and add an entry for the Time and Value fields separately, and set them to hidden.

That’s it! Now you get the table shown at the beginning of this article.

This is only version 1 of the kubedex-exporter. I’m planning on adding another label to the helm_chart_info metric that displays current latest chart version. Then we can create another table showing out of date charts.

If you want to contribute to the exporter you can find it here: https://github.com/Kubedex/exporter

Related

The Kubedex second update.In the first update I said I'd do a list of things. In summary, I mostly succeeded.…

Read more

Kubedex.com is over 1 month old! Well, barely, 1 month and 2 days to be precise. Blog Updates People have been…

Read more

Beginners Guide to Helm Helm is the package manager for Kubernetes. It is the easiest way to install new applications…

Read more

Tell us about a new Kubernetes application

Newsletter

Never miss a thing! Sign up for our newsletter to stay updated.

About

Discover and share new Kubernetes applications

Navigation