DEV Community

Zahid Ahmed
Zahid Ahmed

Posted on • Edited on

AWS Deploy Single Node Kubernetes Cluster

Instead of a full-blown Kubernetes cluster, the single node instances are best for both development and testing. Let's go with lightweight Kubernetes managed by Canonical, Microk8s.

MicroK8s is the easiest and fastest way to get Kubernetes up and running. Experiment with the latest upstream features and toggle services on and off. Seamlessly move your work from dev to production. 😎✌🏻

Install MicroK8s on Ubuntu Server

Install MicroK8s:

$ sudo snap install microk8s --classic
Enter fullscreen mode Exit fullscreen mode

Check Status:

$ microk8s status --wait-ready
Enter fullscreen mode Exit fullscreen mode

Add Your Current User To MicroK8s Group:

$ sudo usermod -a -G microk8s $USER
$ sudo mkdir ~/.kube && sudo chown -R $USER ~/.kube
$ sudo newgrp microk8s
Enter fullscreen mode Exit fullscreen mode

Enable Services That You Will Need:

$ microk8s enable dns
$ microk8s enable dashboard
$ microk8s enable storage
$ microk8s enable ingress
$ microk8s enable gpu
$ microk8s enable istio
$ microk8s enable registry
Enter fullscreen mode Exit fullscreen mode

To Disable Any Of These Services Later:

$ microk8s disable dns 
Enter fullscreen mode Exit fullscreen mode

Check the Status Of Kubernetes Services:

$ microk8s kubectl get all --all-namespaces
Enter fullscreen mode Exit fullscreen mode

To login web-based dashboard generate a token with the following commands, and then paste it into login prompt:

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

Get Rid Of Microk8s & Use Kubectl:

$ alias kubectl="microk8s kubectl"
Enter fullscreen mode Exit fullscreen mode

Lookup Pod & Node Details:

$ kubectl get nodes
$ kubectl get pods -o wide
Enter fullscreen mode Exit fullscreen mode

Start & Stop MicroK8s Service:

$ microk8s start
$ microk8s stop
Enter fullscreen mode Exit fullscreen mode

Uninstall MicroK8s

$ sudo snap remove microk8s
Enter fullscreen mode Exit fullscreen mode

Top comments (0)