Monitoring Microservices With Weave Cloud you learned how the Weave Cloud agents collects data from your Kubernetes cluster stores them in Weave Cloud and how to monitor your infrastructure and applications with Prometheus. However you may want to hook up the metrics collected by Weave Cloud and visualize them with the popular dashboard add-on Grafana.

In this tutorial you will integrate Grafana dashboards to analyze metrics from the Sock Shop that were collected by Weave Cloud. By the end of this tutorial you should be looking at a set of dashboards like this:

Kubernetes Resources

Sock Shop Resources

Getting Started

We base this tutorial on the premise that you have already setup a Kubernetes cluster in Google Cloud from the previous tutorial. If you haven’t done so yet, you must first go back and follow the steps mentioned there and then come back here.

Configure Grafana

For Grafana to be able to pull data from Weave Cloud we are first going to need to supply the credentials necessary for it to be able to talk to the Weave Monitor API. Open the file deploy/kubernetes/manifests-monitoring/grafana-configmap.yaml and find the block that says prometheus-datasource.json and then make sure that it looks like the example down below:

prometheus-datasource.json: |
  "name":              "prometheus",
  "type":              "prometheus",
  "url":               "",
  "access":            "proxy",
  "basicAuth":         true,
  "basicAuthUser":     "weave",
  "basicAuthPassword": "<weave cloud token here>"

Don’t forget to add your Weave Cloud token to the basicAuthPassword field.

Deploy Grafana

To deploy Grafana to the cluster:

kubectl create namespace monitoring
kubectl apply -f deploy/kubernetes/manifests-monitoring/grafana-configmap.yaml \
  -f deploy/kubernetes/manifests-monitoring/grafana-dep.yaml \
  -f deploy/kubernetes/manifests-monitoring/grafana-svc.yaml \
  -f deploy/kubernetes/manifests-monitoring/grafana-import-dash-batch.yaml

Accessing Grafana

Now we need to figure out the public IP of our Grafana instance. Kubernetes has the answer to that:

kubectl get svc -n monitoring | grep grafana | awk '{ print $3 }'

Take that IP and open it up on your browser.

The default user/password is admin:admin. You should now be able to see the dashboards for Kubernetes and for the Shop.