MicroK8s is a lightweight, upstream, production-grade, conformant Kubernetes that can run anywhere, from a developer workstation to edge and IoT appliances. It can be used as a single-node or multi-node. If used as a multi-node, MicroK8s becomes highly available automatically.

MicroK8s is a cloud-native infrastructure that lets developers focus on production levels like adding value to the business. It is a Zero-Ops Kubernetes, just set it up and let it run. It will then perform over-the-air updates and security fixes needed without any administration.

MicroK8s is easy to install, requires no configuration as it sets the defaults and it can be run on any operating system. You can choose to configure the defaults but most people do not as they simply ‘work’.

Some of the use cases include;

  • Edge
  • Building CI/CD pipelines
  • Artificial Intelligence
  • Machine Learning 
  • IoT

This guide will show you how to install MicroK8s on KDE Neon|Kubuntu.

Install MicroK8s on KDE Neon / Kubuntu

First, update your package list using the following command.

###KDE Neon###
sudo apt update
sudo pkcon update -y

### Kubuntu ###
sudo apt update && sudo apt upgrade -y

Install snap first on your KDE Neon / Kubuntu system.

sudo apt install snapd

Install microK8s using snap command line tool

sudo snap install microk8s --classic

Sample installation output

microk8s (1.23/stable) v1.23.4 from Canonical✓ installed

Configure the firewall to allow pod-to-pod and pod-to-internet communication

sudo ufw allow in on cni0 && sudo ufw allow out on cni0
sudo ufw default allow routed

To add a User to MicroK8s Group, use the following command.

sudo usermod -a -G microk8s $USER

This will allow you to run the commands without appending ‘sudo‘ at the beginning of each command

Use this command for the group change to take place without login out.

newgrp microk8s

Check status while Kubernetes starts

microk8s status --wait-ready

Sample Output

microk8s is running
high-availability: no
  datastore master nodes:
  datastore standby nodes: none
    ha-cluster           # Configure high availability on the current node
    ambassador           # Ambassador API Gateway and Ingress

Enable addons like dns and dashboard.

$ microk8s enable dns dashboard
Enabling DNS
Applying manifest
serviceaccount/coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created
clusterrole.rbac.authorization.k8s.io/coredns created
clusterrolebinding.rbac.authorization.k8s.io/coredns created
Restarting kubelet
DNS is enabled
Enabling Kubernetes Dashboard
Enabling Metrics-Server
serviceaccount/metrics-server created

Check deployment progress using the following command

$ microk8s kubectl get all --all-namespaces
NAMESPACE     NAME                                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
default       service/kubernetes                  ClusterIP     <none>        443/TCP                  9m51s
kube-system   service/kube-dns                    ClusterIP    <none>        53/UDP,53/TCP,9153/TCP   2m3s
kube-system   service/metrics-server              ClusterIP    <none>        443/TCP                  109s
kube-system   service/kubernetes-dashboard        ClusterIP   <none>        443/TCP                  104s
kube-system   service/dashboard-metrics-scraper   ClusterIP   <none>        8000/TCP                 103s

kube-system   daemonset.apps/calico-node   1         1         1       1            1           kubernetes.io/os=linux   9m47s

Access MicroK8s Kubernetes Dashboard

To access the Kubernetes dashboard, use the Cluster IP and listening port assigned. This is done randomly. As we can see above the Kubernetes dashboard is assigned a cluster IP of and a Listening port of 443. If I head over to my browser and put I will get to see the dashboard.

But first, to access it, you must put a token retrieved by the following command for security reasons.

token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
microk8s kubectl -n kube-system describe secret $token

You copy the token and paste it on the login page.

Then once logged in, you can view the dashboard as shown below.

Access Kubernetes Dashboard using NodePort

Patch the Service to listen use NodePort

microk8s kubectl patch svc kubernetes-dashboard --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]' -n kube-system

Confirm Port assigned

$ microk8s kubectl get svc -n kube-system
NAME                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
kube-dns                    ClusterIP    <none>        53/UDP,53/TCP,9153/TCP   7m15s
metrics-server              ClusterIP   <none>        443/TCP                  7m3s
dashboard-metrics-scraper   ClusterIP    <none>        8000/TCP                 6m59s
kubernetes-dashboard        NodePort    <none>        443:32394/TCP            6m59s

You can the access Dashboard on https://micork8s-server-ip:nodeport

Get Token and use it to authenticate

token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
microk8s kubectl -n kube-system describe secret $token

Hosting Service on Kubernetes on KDE Neon|Kubuntu

1. Hosting Nginx Service (example)

We can rename the command mickrok8s kubectl to mkctl using the following command. which going onwards is what we will use to create a deployment.

alias mkctl="microk8s kubectl"

To host a service, start by creating a deployment. In my case, I will create Nginx deployment by using the following command.

$ mkctl create deployment nginx --image nginx
deployment.apps/nginx created

To expose our deployment we create a service using the following command.

mkctl expose deployment nginx --port 80 --target-port 80 --selector app=nginx --type ClusterIP --name nginx

Sample output

service/nginx exposed

View the using the following command.

$ mkctl get all --all-namespaces
NAMESPACE     NAME                                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
default       service/kubernetes                  ClusterIP     <none>        443/TCP                  40m
kube-system   service/kube-dns                    ClusterIP    <none>        53/UDP,53/TCP,9153/TCP   32m
kube-system   service/metrics-server              ClusterIP    <none>        443/TCP                  32m
kube-system   service/kubernetes-dashboard        ClusterIP   <none>        443/TCP                  32m
kube-system   service/dashboard-metrics-scraper   ClusterIP   <none>        8000/TCP                 32m
default       service/nginx                       ClusterIP   <none>        80/TCP                   11m

You can see the service has been created and you can access it via web browser by using HTTP: and you will get the following page opened.

2. Configuring Prometheus service

Enable addons for Prometheus using the following command.

microk8s enable prometheus dashboard dns

View the services using

microk8s kubectl get services -n monitoring

Sample Output

NAME                    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
prometheus-operator     ClusterIP   None             <none>        8443/TCP                     111s
alertmanager-main       ClusterIP    <none>        9093/TCP                     106s
blackbox-exporter       ClusterIP   <none>        9115/TCP,19115/TCP           106s
grafana                 ClusterIP    <none>        3000/TCP                     104s
kube-state-metrics      ClusterIP   None             <none>        8443/TCP,9443/TCP            104s
node-exporter           ClusterIP   None             <none>        9100/TCP                     104s
prometheus-adapter      ClusterIP   <none>        443/TCP                      103s
prometheus-k8s          ClusterIP   <none>        9090/TCP                     103s
alertmanager-operated   ClusterIP   None             <none>        9093/TCP,9094/TCP,9094/UDP   0s
prometheus-operated     ClusterIP   None             <none>        9090/TCP                     0s

Get pods in the monitoring namespace.

$ microk8s kubectl get pods -n monitoring
NAME                                   READY   STATUS    RESTARTS      AGE
node-exporter-p8dt7                    2/2     Running   0             69s
prometheus-operator-667757c7b9-mw9x5   2/2     Running   0             69s
kube-state-metrics-bbd47c478-q5bjs     3/3     Running   0             69s
prometheus-adapter-5b7fb5c557-j9mdd    1/1     Running   0             69s
prometheus-adapter-5b7fb5c557-krv49    1/1     Running   0             69s
grafana-59f6895cb8-zzdrc               1/1     Running   0             69s
blackbox-exporter-5c4d9867d6-4kxz8     3/3     Running   0             69s
alertmanager-main-0                    2/2     Running   0             56s
prometheus-k8s-0                       2/2     Running   1 (33s ago)   56s

Set port forwarding to enable external access

microk8s kubectl port-forward -n monitoring service/prometheus-k8s --address 9090:9090

Sample Output:

Forwarding from -> 9090

Now access it via the browser on I will use the cluster IP and its listening port. HTTP:// . Then it will show the Prometheus UI.

Other microk8s management commands

To reset MicroK8s use the following command.

microk8s reset

To stop and start the service use the following command.

microk8s stop
microk8s start

To check the status of the service use the command below.

microk8s status

To disable and enable microK8s

snap disable microk8s
snap enable microk8s

To show Configuration

microk8s config


From this guide, you have gotten an introduction to MicroK8s service. You have learned how to install MicroK8s on KDE Neon||Kubuntu. You have also learned how to host a service specifically Nginx on Kubernetes by creating and exposing the service. We have also enabled Prometheus Login. Remember to add the user to the MicroK8s group to run commands without appending sudo.

More guides:


Please enter your comment!
Please enter your name here