This is a script to create multipass instances to deploy k3s or microk8s kubernetes distribution
In order to use this script, you need to install multipass
snap package, provided by canonical. To install execute the follow command
sudo snap install multipass
Variable | Description | Default value |
---|---|---|
MASTER_NODE_COUNT | The number of master nodes that will be avaliable |
1 |
MASTER_NODE_PREFIX | The prefix to use in master instances name |
master |
WORKER_NODE_COUNT | The number of worker nodes that will be avaliable |
2 |
WORKER_NODE_PREFIX | The prefix to use in worker instances name |
worker |
KUBERNETES_DISTRIBUTION | The kubernetes distribution to use. For now only k3s and microk8s |
k3s |
First of all, if you want to get all fixes for bugs, i recommend that you clone this gist. For that, execute the command above:
git clone git@gist.github.com:a11088b3145e91d2d4d766b49ebe0d81.git kubernetes-bootstrap
To use the default options(one master node and two worker nodes), execute the script in cloned folder
./kubernetes-bootstrap.sh
To change any option, just precede the script call with specific variable.
WORKER_NODE_COUNT=4 MASTER_NODE_PREFIX=controller KUBERNETES_DISTRIBUTION=microk8s ./kubernetes-bootstrap.sh
To interact with the cluster, use one of the above:
kubectl --kubeconfig=${HOME}/.kube/k3s.yaml get nodes
kubectl --kubeconfig=${HOME}/.kube/microk8s.yaml get nodes
NAME STATUS ROLES AGE VERSION
worker-2 Ready <none> 99m v1.17.2+k3s1
worker-3 Ready <none> 98m v1.17.2+k3s1
controller-1 Ready master 103m v1.17.2+k3s1
worker-4 Ready <none> 96m v1.17.2+k3s1
[ ] Enable multi master cluster