Install Vanilla Kubernetes Cluster on Ubuntu.
Here We are Installing Vanilla Flavour of Kubernetes Cluster(With High Availablility), Which is Small but Production-Ready.
- You need to have at least Two VMs(Master Node and Slave Node)
- Both VMs should connected on the Same Network.
- Master Node must have 2 CPUs and at least 2 GB of RAM.
- Swap must be turned OFF on Both of the VM(s).
- A basic understanding of Linux, Networking and docker unless you are a magician. 😉
Run Following Command on Master Node.(Without Hash 😛 )
# apt install docker.io
# systemctl enable docker
# apt install curl
# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
# apt-add-repository “deb http://apt.kubernetes.io/ kubernetes-xenial main”
# apt install kubeadm
After Running all the Commands above you would be able to Install All Kubernetes Packages on the Master Node.
Now you need to Deploy Cluster. Run Following Commands.
# swapoff -a
# hostnamectl set-hostname master-node
# kubeadm init –pod-network-cidr=10.244.0.0/16 (Look at it’s output Carefully!!)
# mkdir -p $HOME/.kube
# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# chown $(id -u):$(id -g) $HOME/.kube/config
Deploy Pod Network: (There are different Types of Networks you can use. Here we are using flannel)
Add the slave node to the network in order to form a cluster.
Run the Command which you will get in output after running this:
“kubeadm init –pod-network-cidr=10.244.0.0/16” on you Master Node. make sure you have to run Command which will lokk like Following on Your Slave-node. So you can use Kubernetes Cluster.
** Don’t Run Following Command as it is.
kubeadm join 172.31.9.252:6443 –token bixhtx.4bqyhe45g8fvhqeq \
Other Comman Kubernetes commands to Play with your Cluster:
# kubectl get nodes
# kubectl get pods –all-namespaces
Enjoy your Cluster!!