A few notes about devops and automation

Microk8s with kubectl, not microk8s.kubectl

· Read in about 1 min · (155 Words)

Let’s install MicroK8s, the easiest way to install Kubernetes on your computer. After that, let’s configure our system to use kubectl instead of microk8s.kubectl.

Prerequisites

Your Linux distribution needs to support Snaps. https://snapcraft.io/docs/installing-snapd

Install it

Just head over to: https://microk8s.io/docs/ or go ahead and follow my lead:

sudo snap install microk8s --classic

Join the group

sudo usermod -a -G microk8s $USER

Add some extras

microk8s.enable dns dashboard

Add the config to your existing config

As root:

sudo su
cd /var/snap/microk8s/1173/credentials/
cp client.config /home/<YOUR-USERNAME>/Desktop/client.config

As your non root user. Make sure to backup your existing config first!

sudo chown $USER.$USER /home/$USER/Desktop/client.config
KUBECONFIG=config:~/Desktop/client.config:~/.kube/config-ok kubectl config view --flatten > ~/.kube/config

View the dashboard

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

kubectl port-forward -n kube-system service/kubernetes-dashboard 10443:443

Log in with the token:

kubernetes-moonstreet

And behold the dashboard:

dashboard-moonstreet

So there is a Kubernetes cluster in a few minutes.

Comments