---
title: Edge computing monitoring with Kubernetes
description: Edge computing monitoring for IoT using Grafana and Prometheus on Kubernetes
url: https://canonical.com/blog/monitoring-at-the-edge-with-microk8s?format=md
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[Galem KAYO](https://canonical.com/blog/author/galemk "More about Galem KAYO")

29 July 2019

# Edge computing monitoring with Kubernetes

[analytics](https://canonical.com/blog/tag/analytics)
[data](https://canonical.com/blog/tag/data)
[Edge gateway](https://canonical.com/blog/tag/edge-gateway)
[IoT](https://canonical.com/blog/tag/iot)
[kubernetes](https://canonical.com/blog/tag/kubernetes)
[MicroK8s](https://canonical.com/blog/tag/microk8s)

---

Share the article

This blog demonstrates how to easily deploy monitoring tools at the edge using Kubernetes. In IoT scenarios, such a deployment brings the benefits of privacy, latency and minimal bandwidth cost.

Luckily, MicroK8s the single node Kubernetes, caters for such use cases. The beauty of MicroK8s is that deployment can be done in a couple of commands and in under a minute. MicroK8s [can even fit on a Raspberry Pi](https://ubuntu.com/blog/single-node-kubernetes-on-raspberry-pi-microk8s-ubuntu). It is possible to build a monitoring stack on MicroK8s, deployable anywhere, even at the extreme edge. From a technical perspective, this simple solution is created using some of the popular open source components that are delivered out of the box with MicroK8s. These are:

* Grafana for the front-end analytics dashboard
* Prometheus for the back-end time-series database (ideal for sensor data)

To get up and running, follow these steps:

#### **Installing MicroK8s, Grafana and Prometheus**

First, install the MicroK8s snap

```
sudo snap install microk8s --classic
```

Once installed, it is possible to list all the add-ons that are delivered with MicroK8s.

```
microk8s.status
```

(alternatively)

```
 microk8s.enable --help
```

None of the MicroK8s add-ons are enabled by default. Therefore Grafana and Prometheus will need to be enabled upon installation. Here is how to launch these applications:

```
microk8s.enable dashboard prometheus
```

There is no specific command to enable Grafana. It is launched automatically when the Kubernetes dashboard is enabled.

### **Accessing the Kubernetes dashboard**

For the next steps, the kubectl command will be invoked. It is possible to alias this command because it is namespaced in Microk8s. This step is simple to reverse if it loses convenience.

```
sudo snap alias microk8s.kubectl kubectl
```

The access token for the Kubernetes dashboard can then be retrieved by invoking kubectl as shown below:

```
export TOKEN=$(kubectl describe secret $(kubectl get secret | awk '/^dashboard-token-/{print $1}') | awk '$1=="token:"{print $2}') && echo -e "\n--- Copy and paste this token for dashboard access --\n$TOKEN\n---"
```

To access the Kubernetes dashboard, it will be necessary to create a secure channel to the cluster with the command below:

```
kubectl proxy &
```

The dashboard will then be accessible at:

```
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
```

Copying and pasting the token generated above will grant you access to the web based command interface to your cluster.

### **Accessing Grafana and Prometheus**

As an initial step, we can confirm that Grafana and Prometheus are running on the cluster.

```
kubectl cluster-info
```

Once confirmed, you can view these services in the Kubernetes dashboard by selecting ‘monitoring’ under ‘Namespaces’, and then clicking ‘Services’. The list of monitoring services running on the cluster will then be displayed, along with the associated cluster IP addresses, internal endpoints and ports.

The Grafana and Prometheus UIs can then be simply accessed by entering the service IP and ports in the browser, according to the following format:

```
<cluster IP>:<port>
```

For Grafana, the username and password will be: admin/admin.

Grafana comes pre-configured with Prometheus as a data source.

The Prometheus UI can be accessed in a similar manner. No username and password will be required.

### **Going further**

Further to this easy setup, it is possible to feed sensor data to the Prometheus database. Prometheus has [several client libraries for exporting sensor measurements](https://prometheus.io/docs/instrumenting/clientlibs/). Additionally, [panels and custom dashboards](https://grafana.com/docs/guides/basic_concepts/) will be created in Grafana according to the metrics that are tracked for a particular use case.

### **Resources**

[MicroK8s](https://microk8s.io/)

[Running Microk8s on Raspberry Pi](https://ubuntu.com/blog/single-node-kubernetes-on-raspberry-pi-microk8s-ubuntu)

[Prometheus client libraries](https://prometheus.io/docs/instrumenting/clientlibs/)

[Grafana basic concepts](https://grafana.com/docs/guides/basic_concepts/)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

By submitting this form, I confirm that I have read and agree to [Canonical's Privacy Policy](https://canonical.com/legal/dataprivacy).

Sign up

## Share on

---

## Related posts

[### How to set up a micro lab: four principles for a reliable homelab](https://canonical.com/blog/how-to-set-up-a-reliable-homelab)

After over a decade of running a homelab, I have learned a few difficult lessons. Although it begins as a “lab,” you inevitably end up with something you want to keep. If a...

[Jake Nabasny](https://canonical.com/blog/author/slapcat)

17 March 2026

[### Arduino® VENTUNO™ Q is available for pre-order with Ubuntu pre-installed](https://canonical.com/blog/arduino-ventuno-q-is-available-for-pre-order-with-ubuntu-pre-installed)

London, UK – August 25, 2026 – Following our initial collaboration announcement in March 2026, Canonical and Arduino (a subsidiary of Qualcomm Technologies, Inc.) are excited...

[Canonical](https://canonical.com/blog/author/canonical)

25 August 2026

[### Advantech AOM-2721 is now Ubuntu Certified](https://canonical.com/blog/advantech-aom-2721-ubuntu-certified)

Canonical announces that the Advantech AOM-2721 is officially joining the list of Ubuntu Certified Hardware.

[Mikhail Khazov](https://canonical.com/blog/author/khazov-m)

13 August 2026

[### So you need to add microcontrollers to your fleet: now what?](https://canonical.com/blog/microcontrollers-ubuntu-core-golioth)

Your Ubuntu Core fleet is running beautifully. OTA updates roll out in minutes. Every device is strictly confined, cryptographically attested, and carrying a 10 to 15 year long...

[Jonathan Beri](https://canonical.com/blog/author/jmberi)

18 June 2026
