Create a Kubernetes cluster in 5 mins

Prasad Paravatha
2 min readMay 1, 2020

Setup Kubernetes on a AWS EC2 instance

Kubernetes

What? : https://microk8s.io/

How? :

  1. Create your own EC2 : I used t3.2xlarge with Ubuntu 18.04 LTS
  2. Login to your EC2 and run the below commands to install microk8s
sudo snap list
sudo snap install microk8s --classic --channel=stable

3. Check if the cluster is up and running

sudo microk8s.kubectl cluster-info

4. Enable DNS, Storage, Dashboard, Istio and Prometheus

sudo microk8s.enable dns storage dashboard ingress istio prometheus

5. Setup kubectl

sudo snap alias microk8s.kubectl kubectl
sudo usermod -a -G microk8s ubuntu

6. Setup kube config

sudo chown -f -R ubuntu ~/.kube
sudo microk8s.kubectl config view --raw > $HOME/.kube/config
exit & login
kubectl get pods -A

7. Open proxy

sudo microk8s.kubectl proxy — accept-hosts=.* — address=0.0.0.0 &

8. As this is a dev cluster to learn kubernetes, you can skip the login option on the dashboard (Not recommended for a public facing kubernetes)

sudo microk8s.kubectl -n kube-system edit deploy kubernetes-dashboard -o yaml** search for "namespace=kube-system", enter the below line after
- --enable-skip-login

9. Access the dashboard from : http://{public-ip}:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy

10. Viola!

--

--