A Kubernetes cluster can be bootstraped in many different ways. Bootstrapping using kubeadm tool is quite easy when compared to other methods. However, one needs to follow a good amount of steps across clusters when it is done manually.
This repository holds the automated scripts for master and worker nodes to setup the cluster in no time. The scripts are developed for Ubuntu and can work well on Ubuntu 18.04 Bionic Beaver.
The master and worker nodes should be having Ubuntu (18.04 LTS is recommended) installed.
It is nice to have a meaningful unique hostnames to each node. For example, hostname 'master' for master node and hostname 'node01' for worker node and so on.
- Execute deployment script in master node as shown below.
master>bash deploy-k8s-master.sh
- Once successful check the cluster status by running:
master>kubectl get nodes
- Execute deployment script in worker node as shown below:
worker>bash deploy-k8s-worker.sh
- Now worker needs to be joined in the cluster. Run the below command in master node which will print to command to join.
master>kubeadm token create --print-join-command
This would print kubeadm join command something like,
sudo kubeadm join ...
Copy and execute the same in worker node(s).
That's all. If you run kubectl get nodes
in master, you will see the worker has joined the cluster.