demo-infra-install.sh 957 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#!/bin/bash

# install microk8s
sudo snap install microk8s --classic --channel=1.18/stable
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
su - $USER

# test microk8s
microk8s status --wait-ready
microk8s inspect

# test kubernetes
microk8s kubectl get nodes
microk8s kubectl get services

# add dns, dashboard, ingress and storage to microk8s
microk8s enable dns dashboard ingress storage

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

# setup local execution environment
sudo ln -s /snap/microk8s/current/kubectl /usr/local/bin/kubectl
kubectl config view --raw > ~/.kube/config

# create namespaces
kubectl create -f namespace-demo.json

# install helm
sudo snap install helm --classic

# add stable repo do helm3
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm repo update