Adding Linkerd 2.x data to your main Grafana dashboard.

Build a single global dashboard for your cluster by adding a data source for Linkerd 2.x metrics.

Adding Linkerd 2.x data to your main Grafana dashboard.

Adding linkerd 2.x data to your primary Grafana dashboard is great for building an overall dashboard.


In this article I am assuming you already have a cluster with Prometheus & Grafana for node data. 
If you haven’t, checkout this article. It will only take a few minutes to get this setup.

Install the Linkerd cli

Linkerd have instructions here. For the short I have documented the basics below.

First download and install the cli

$ curl -sL | sh

Export the linkerd bin directory to your path

$ export PATH=$PATH:$HOME/.linkerd2/bin
# You can also have this permanently linked.
# This will link it on startup or when a new terminal is loaded.
$ echo 'export PATH="$PATH:$HOME/.linkerd2/bin"' >> ~/.bash_profile
$ source ~/.bash_profile

Confirm the installation

$ linkerd version
Client version: stable-2.2.0
Server version: unavailable

Install Linkerd on your cluster.

Just before we start, I want to make it clear that linkerd install does nothing amazing. It merely outputs the Kubernetes yaml configs required to run Linkerd. This is why we pipe it into kubectl apply later.

Its always valuable to look through the output. 
1. See what linkerd is actually deploying & doing
2. Possibly learn something about how the big guns are doing their configs ?

If you would like to inspect what linkerd is deploying, simply run

$ linkerd install >> linkerd.yml

This will insert the output from linkerd install into a file called linkerd.yml

If you open this file you will see a bunch of configs which linkerd will deploy

You 1 — Magic 0.

With that being said. Lets make sure the cluster is ready for linkerd

$ linkerd check --pre 

The above command will ensure linkerd can be installed and operate on the cluster.

Now we install linkerd. Pay attention to the syntax here. All we are doing is piping linkerd yaml configs into kubectl apply with 
| kubectl apply -f -

$ linkerd install | kubectl apply -f -
namespace/linkerd created
serviceaccount/linkerd-controller created

Inspect linkerd in the cluster

$ kubectl get pods -n linkerd
NAME                                  READY   STATUS
linkerd-controller-5dfbd756b7-snwpw   4/4     Running
linkerd-grafana-55784d8c8c-nmhdz      2/2     Running
linkerd-prometheus-64854cdffd-r5phv   2/2     Running
linkerd-web-7845d9cf6d-9m5x8          2/2     Running

Proxy linkerd’s dashboard to see what it looks like

$ linkerd dashboard
Linkerd dashboard available at:
Grafana dashboard available at:
Opening Linkerd dashboard in the default browser

Go to the address it spits out above and you should see something like this:

The Linkerd default dashboard

Now in the search bar enter the second address that got spit out. It ends with /grafana .

This will open linkerd’s grafana dashboard.

Linkerd Grafana dashboard

The kicker.

We now have 2 dashboards. One for our grafana, and one for linkerd’s.

If you work in a space like I do, you also just want to look up and see a dashboard with all the metrics together.

So we need to add the linkerd data and dashboard to our own Grafana.

Add the Linkerd data source to Grafana.

Proxy your instance of grafana.

If you have used the article mentioned above. You should just be able to run:

$ kubectl port-forward $(kubectl get pods --namespace monitoring -l "app=grafana,release=grafana" -o jsonpath="{.items[0]}") 3000

Get the password for your Grafana instance.

$ kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

Go to http://localhost:3000 in your browser. You should see the grafana login screen.

Login with the username and password from above.

Navigate to the left menu and click on Configuration > Data Sources

Click Add data source and select Prometheus as the data source type. You should see this screen.

Change the name to something suitable like Linkerd Prometheus .

We are going to point the URL at a service which linkerd has deployed, which points at their Prometheus server.

The URL is: http://linkerd-prometheus.linkerd.svc.cluster.local:9090

This will ensure that if their Prometheus is moved, we can still reach it through the Kubernetes service.

Click Save & Test . You should see a new dialog box showing that the data source is working.

Add the Linkerd dashboard to Grafana

When you have saved the data source, click on Dashboards > Manage in the left-hand navigation.

Click + Import.

Now for adding your dashboards.

You can find all the Linkerd preconfigured dashboards here

Check those out to decide which ones you want to import. Copy the JSON and paste it in the import box. You might need to update the datasource for the dashboard to use your new Linkerd data source.

Enjoy !