Create a Kubernetes cluster in 5 mins

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

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

10. Viola!

My personal blog | Not a real ninja | https://github.com/paravatha

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store