Low Orbit Flux Logo 2 D

Kubernetes - MicroK8s - Ubuntu

Install it from a snap:

sudo snap install microk8s --classic

Add user to the microk8s group:

sudo usermod -a -G microk8s user1

Check status and wait until it is ready:

microk8s status --wait-ready

Enable these components:

microk8s enable dashboard dns registry istio
microk8s disable dashboard dns registry istio
microk8s kubectl get all --all-namespaces

Setup aliases for the kubectl command:

alias mkctl="microk8s kubectl"
alias kubectl="microk8s kubectl"

Launch the dashboard-proxy:

microk8s dashboard-proxy

Start or stop MicroK8s:

microk8s start
microk8s stop API server dashboard


Do this on both nodes ( needs at least 1.19 ):

sudo snap install microk8s --classic --channel=1.19/stable       # install 
sudo snap refresh microk8s --classic --channel=1.19/stable       # or update

On first host:

microk8s add-node

On second host (replace token):

microk8s join

Setup a failure domain and restart:

echo "failure-domain=42" > /var/snap/microk8s/current/args/ha-conf

Run on the node that is leaving:

microk8s leave

Run on another node:

microk8s remove-node host1

Force removal from another node in case we weren’t able to run leave ( due to crash, etc. ):

microk8s remove-node host1 --force

Add a worker:

microk8s add-node
microk8s join --worker

Configure Services


Edit this file:

vi /var/snap/microk8s/current/args/containerd

Restart the service:

sudo systemctl restart snap.microk8s.daemon-containerd.service

Stop and start MicroK8s:

microk8s stop
microk8s start