Skip to main content

Get started with Kubernetes and microk8s

Updated by Tim Rabbetts on
container, ship, container ship

I've used docker and docker-compose until now, but now looking at possible production containerization and its clear Kubernetes is the way to go.  

Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.

It groups containers that make up an application into logical units for easy management and discovery. Kubernetes builds upon 15 years of experience of running production workloads at Google, combined with best-of-breed ideas and practices from the community.

First thing lets install microk8s, I didn't like minikube, seemed like a learning tool rather than a developer tool.  

sudo snap install microk8s --classic --channel=1.18/stable
sudo microk8s enable dns dashboard registry
sudo usermod -a -G microk8s $USER
microk8s status --wait-ready

microk8s commands should run without sudo, try reboot if not working.

If you don't get decent output, maybe stop and start microk8s:

microk8s.stop
microk8s.start

Now lets try and access the dashboard, run this:

microk8s kubectl get all --all-namespaces

Should see something like this:

service/kubernetes-dashboard        ClusterIP   10.152.183.126

So if you go to that IP address in your browser you will then need a token, to generate a token run this:

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

You should now see your kubernetes dashboard, good start, next step is to stepup our pods using yaml, article to follow soon.

Add new comment