The goal of this project is to update a single node instance of MicroK8s running on a Raspberry Pi . Having recently updated the Raspberry Pi with the latest LTS version of Ubuntu, the decision was taken to refresh the existing instance of MicroK8s, and at the same time transition from the deprecated Kubernetes Dashboard to a Grafana/Portainer based solution.
This article documents the steps taken to update the MicroK8s instance and configure network access for Grafana and Portainer CE on the refreshed instance.
For context I should reiterate the health warning on the projects main page and point out the following;
- The Microk8s instance is a development environment not a production environment, so not business critical.
- It is a single node instance, not a cluster.
- It is not currently running any workloads.
- The steps as described worked at the time but past experience of Microk8s would tend to indicate that change is inevitable and as a consequence, things break.
You are welcome to replicate what you see here but you should ensure that the configuration and security measures taken are sufficient for your needs and adjust them to suit your circumstances.
Installing MicroK8s/Kubernetes on Raspberry Pi
This project starts from the base of having an instance of MicroK8s installed on Ubuntu version 26.04 LTS, If you don’t have MicroK8s installed it can be installed via a snap using these instructions.
Notes for installation…
At the time of writing the installation instructions were over a year old and there were some differences between the Canonical installation instructions and what was installed for this project.
- The step to edit cgroups identifies the path /boot/firmware/cmdline.txt. As a result of the Ubuntu’s A/B (tryboot) kernel update scheme the cmdline.txt file was found at /boot/firmware/cmdline.txt.
- The installation command installs v1.30 of the MicroK8s snap, the latest stable version and the one used in this project is version 1.36. If you are following this starting with a clean MicroK8s installation I would recommend installing at least v1.36 as the upgrade procedure is laborious.
Refresh MicroK8s
As there were no workloads running on the instance, the instance was reset to a clean install with the following command.
sudo microk8s reset
This will remove any addons installed and reset the instance to a default state. Uninstalling all addons may seem drastic but upgrading MicroK8s does not upgrade the addons at the same time. This would mean that unsupported addons and deprecated addons would be being disabled with each upgrade step. It seemed cleaner to uninstall all addons from the start, upgrade MicroK8s through all the versions and then reinstall supported addons on the current version.
Upgrade MicroK8s
Upgrading MicroK8s is only supported one point at a time i.e. it is inadvisable to skip versions in the upgrade path.
sudo snap refresh microk8s --channel=1.27/stable
# Increment to the next point release
sudo snap refresh microk8s --channel=1.28/stable
# rinse / repeat to ...
sudo snap refresh microk8s --channel=1.36/stable
Install the Addons
There is some guesswork involved here but the dns and hostpath-storage addons are recommended in the MicroK8s getting started documentation and the MetalLB load balancer and Ingress addons will be required to make the Grafana and Portainer instances available outside the host machine.
microk8s enable dns
microk8s enable hostpath-storage
microk8s enable metallb
microk8s enable ingress
MetalLB installation…
The Metallb installation prompts for an address pool on the host network. In our case the range 192.168.1.201-192.168.1.250 was selected.
The configured IP address pool be checked with the following command:
microk8s kubectl get ipaddresspool -n metallb-system -o yaml
This is just a basic set of core addons, more addons (cert-manager, observability, portainer) are added later.
The list of installed and available addons can be confirmed with the following command.
microk8s status
A review of the running pods and services revealed that the metallb controller and speaker applications were in a crash loop. A search of the logs showed that they were failing due to this known issue of missing RBAC details for configurationstates.
The following patches were applied:
- Create a patch file.
cat << 'EOF' > metallb-rbac-patch.json
[
{
"op": "add",
"path": "/rules/-",
"value": {
"apiGroups": ["metallb.io"],
"resources": [
"configurationstates",
"configurationstates/status"
],
"verbs": [
"get",
"list",
"watch",
"create",
"update",
"patch",
"delete"
]
}
}
]
EOF
- Apply the patch to the controller and the speaker.
microk8s kubectl patch clusterrole metallb-system:controller --type='json' --patch-file=metallb-rbac-patch.json
microk8s kubectl patch clusterrole metallb-system:speaker --type='json' --patch-file=metallb-rbac-patch.json
- Restart the Applications.
microk8s kubectl rollout restart deployment controller -n metallb-system
microk8s kubectl rollout restart deployment speaker -n metallb-system
Note: In the issue report the user suggests that there might be a similar problem with servicebgpstatuses. I did not encounter any errors associated with servicebgpstatuses because in this case, its a single instance node (no BGP peers), so I’ve not attempted to fix them here, YMMV.
Add the Cert-Manager
The cert-manager addon installs Cert-Manager which provides certificate management services for the cluster. In this case we’ll only be providing self-signed certificates because a lets-encrypt based solution requires a cluster with a public IP address and that isn’t the case here.
Enable the addon with the command below:
microk8s enable cert-manager
At this point I created an ingress service but I’m not certain why – could have been a mistake or a test.
- Create an ingress service description file
nano ingress-service.yml
- Add the following content.
apiVersion: v1
kind: Service
metadata:
name: ingress
namespace: ingress
spec:
selector:
app: ingress
type: LoadBalancer
# loadBalancerIP is optional. MetalLB will automatically allocate an IP
# from its pool if not specified. You can also specify one manually.
# loadBalancerIP: x.y.z.a
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
- name: https
protocol: TCP
port: 443
targetPort: 443
- Create the service / apply the yaml.
microk8s kubectl apply -f ingress-service.yml
- Check Ingress Service created
microk8s kubectl get svc -n ingress
Create the ClusterIssuer (self-sign)
- Create a cluster issuer description file
nano cluster-issuer-selfsign.yml
- Add the following content.
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: selfsigned
spec:
selfSigned: {}
A Lets Encrypt configuration…
A configuration for a Lets Encrypt based solution can be found in the official documentation.
- Create the ClusterIssuer / apply the yaml.
microk8s kubectl apply -f cluster-issuer-selfsign.yml
- Confirm the ClusterIssuer has been created.
microk8s kubectl get clusterissuer
Add the Observability Addon.
At the time of writing there is no documentation for the Observability addon but it is a core addon.
The observability addon installs a Prometheus / Grafana stack for logs, traces and metrics.
Enable the addon with the following command.
microk8s enable observability
Confirm the observability stack has been installed.
microk8s kubectl -n observability get services -l "release=kube-prom-stack"
microk8s kubectl -n observability get pods -l "release=kube-prom-stack"
Create a Grafana ingress description file.
nano ingress-grafana.yml
Add the following content.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: selfsigned
name: grafana-ingress
namespace: observability
spec:
ingressClassName: public
tls:
- hosts:
- grafana.<hostname>.local
secretName: grafana-tls
rules:
- host: grafana.<hostname>.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kube-prom-stack-grafana
port:
number: 80
host(s) key values…
The value for the host and hosts keys can be any value; domain or subdomain, as long as they are consistent but but should be memorable as they determine how the web address for service, when accessed from the network.
Create the Grafana ingress / apply the yaml.
microk8s kubectl apply -f ingress-grafana.yml
Confirm that the Grafana Ingress has been created and that Certificates are being issued.
microk8s kubectl get ingress -n observability
microk8s kubectl get certificate -n observability
Note the IP Address for the Grafana website.
The Grafana ingress details above shows the external address for the Grafana website which is required for the hosts file entry below.
The network does not have a configurable DNS service, so in order to make the services discoverable on the network its necessary to edit the hosts file on each machine that will be accessing the services.
Add the DNS record to the hosts file /etc/hosts on the client machine.
# MicroK8s public services on <hostname>.local
192.168.1.201 grafana.<hostname>.local
The IP address should match the external IP address of the ingress and the host name should match the host(s) entry in the ingress-grafana.yml file.
It should be possible to access the Grafana website from the client with either http://grafana.<hostname>.local or https://grafana.<hostname>.local. Note that its not possible to access the website with the external IP address as traefik routing relies on the host header values.
Grafana website credentials…
The default Grafana credentials are:
User name : admin
The admin default password can be retrieved with the following command.
microk8s kubectl -n observability get secrets kube-prom-stack-grafana -o jsonpath="{.data.admin-password}" | base64 -d ; echo

Add the Portainer Addon.
Enable the addon with the following command.
microk8s enable portainer
Confirm the observability stack has been installed.
microk8s kubectl get svc -n portainer
microk8s kubectl get pods -n portainer
Create a Portainer ingress description file.
nano ingress-portainer.yml
Add the following content.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: portainer-ingress
namespace: portainer
annotations:
cert-manager.io/cluster-issuer: selfsigned
spec:
ingressClassName: public
tls:
- hosts:
- portainer.<hostname>.local
secretName: portainer-tls
rules:
- host: portainer.<hostname>.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: portainer
port:
number: 9000
Create the Portainer ingress / apply the yaml.
microk8s kubectl apply -f ingress-portainer.yml
Confirm that the Portainer Ingress has been created and that Certificates are being issued.
microk8s kubectl get ingress -n portainer
microk8s kubectl get certificate -n portainer
Note the IP Address for the Portainer website.
The Portainer ingress details above shows the external address for the Portainer website which is required for the hosts file entry below.
Note: It will be the same as the Grafana
Add the DNS record to the hosts file /etc/hosts on the client machine.
# MicroK8s public services on <hostname>.local
192.168.1.201 portainer.<hostname>.local
The IP address should match the external IP address of the ingress and the host name should match the host(s) entry in the ingress-portainer.yml file.
It should be possible to access the Portainer website from the client with either http://portainer.<hostname>.local or https://portainer.<hostname>.local. Note that its not possible to access the website with the external IP address as Traefik routing relies on the host header values.
Portainer initial setup requires the initial setup token in order to create the first user.
The user name defaults to admin but can be changed. The setup token can be obtained with the following command.
# This will show the pod name.
microk8s kubectl get pods -n portainer
# Use the pod name above to get the last 50 log entries which shows the setup token.
microk8s kubectl logs portainer-<pod>-<name> --tail=50 -n portainer
Portainer setup token expiry…
The Portainer setup token or initial setup page can expire in which case it is a simple matter of redeploying the application to refresh the token.
microk8s kubectl rollout restart deployment/portainer -n portainer

With Grafana and Portainer installed and accessible from the network, all that remains is to deploy workloads to the MicroK8s instance and learn how to create dashboards in Grafana so that they can be monitored.

