Microk8s Installation on Ubuntu and Configure Kubernetes Dashboard

Microk8s is the most happening thing in Kubernetes World. Here I would like to share my exploration of microk8s. Earlier there was 'Minikube' which is targets to Developers community to reduce the operations.

MicroK8s


Assumption
You know how to create a VM using Vagrant, VirtualBox that we had discussed in the other blogposts already so here I'm skipping it.

Microk8s installation on Ubuntu 

To install you should be super user on your Ubuntu VM sudo -i The snap is a package manager available in all Linux distributions. Here in the Ubuntu 18.04 validating is it available. Check snap package tool available
snap version
Now we all set, run the install the microk8s command here the --classic is must
snap install microk8s --classic --edge
Check the version
microk8s.kubectl version --short
Create an alias to simplify your command
alias k="microk8s.kubectl"
Let's use k now
k get nodes
k get nodes -o wide

# check the namespaces list
 k get namespaces
 k get all --all-namespaces
This might take couple of minutes on your laptop that is actually depends on your system capacity and speed. To start the microk8s Duplicate Terminal and try to run a pod. use same aliase here as well. alias k="microk8s.kubectl" on Vagrant user
   sudo usermod -a -G microk8s vagrant
   sudo chown -f -R vagrant ~/.kube

deployment expose k expose deploy nginx --port 80 --target-port 80 type ClusterIP which elinks not installed, so lets install it.
microk8s.start
Once it is installed microk8s we can validate it by inspect option
microk8s.inspect
If there any warnings suggestions goahead and do that. To get all the command options for microk8s
microk8s -h
To get the status of kubenetes cluster
microk8s.status
To get the dashboard
microk8s.enable dashboard dns metrics-server

kubectl get all --namespaces
microk8s kubectl get all -A
kubernetes.service get the ip access in the browser To get the password use admin as user
microk8s.config
To login with Token option on the dashboard need to get the token. microk8s.kubectl -n kube-system get secret |grep kubernetes-dashboard-token microk8s.kubectl -n kube-system describe secrets kubernetes-dashboard-token To terminate your kubernetes cluster on microk8s
microk8s.stop

Deployment to microk8s

microk8s.kubectl create deployment microbot --image=dontrebootme/microbot:v1
microk8s.kubectl scale deployment microbot --replicas=2
For more experiments like this please do watch our YouTube channel


Comments

Popular posts from this blog

Ansible Jinja2 Templates: A Complete Guide with Examples

Ansible 11 The uri module with examples

Jenkins Active choices parameter - Dynamic input