Single Control Plane Cluster Setup using Kubeadm
Single master cluster setup using Kubeadm
Kubeadm is a tool built to provide best-practice “fast paths” for creating Kubernetes clusters. It uses
kubeadm init and
kubeadm join type simple commands for creating a better end-user experience for cluster creation & maintenance.
It enables Kubernetes administrators to quickly and easily bootstrap minimum viable clusters that are fully compliant with Certified Kubernetes guidelines.
As a defacto cluster creation tool, it has been used by projects like minikube, kops, etc.
Kubeadm is focused on bootstrapping Kubernetes clusters on existing infrastructure and performing an essential set of maintenance tasks. Its scope of work includes :
- Creating a control plane node (master node) by
kubeadm init& joining other master and worker nodes by
- It also includes various utilities for performing management tasks like control plane upgrades on already bootstrapped clusters, token and certificate renewal.
What kubeadm is not supposed to do
- Infrastructure provisioning and direct infrastructure manipulation(as done by kops for cloud/on-prem or minikube for local)
- Third-party networking integration
- Monitoring /logging etc.
- Specific cloud provider integration (This actually is handled well by Cloud Controller Manager which will be discussed in details in another blog post)
Creating a Single Control plane cluster using kubeadm
Now let's get our hands dirty with the installation & configuration of
kubeadm to deploy a cluster with a single master and 2 worker nodes.
- 3 Virtual machines with Ubuntu 18.04 installed and sudo privileges. Name one node as
master& other 2 as
- 2 GB or more of RAM per machine.
- 2 CPUs or more on all nodes.
- Setup a Kubernetes cluster with a single master node & two worker nodes
- Complete networking setup for the cluster so that Pods can talk to each other
Steps to be followed on all nodes
- Install container runtime on all three nodes (Docker in the current tutorial)
Installing kubeadm, kubelet and kubectl
We will install the following packages on all three nodes:
kubeadm: the tool to bootstrap the cluster.
kubelet: the component that runs on all of the machines in your cluster as systemd process and does things like starting pods and containers.
kubectl: the command line utility to talk to your cluster.
Setup Control Plane on the node with hostname set to master
kubeadm init successfully we get output that the master node is initialized & we get some command to setup kubectl & also a command for joining worker nodes to this master node.
Note: We are using Calico as a network plugin, so we are using "--pod-network-cidr=192.168.0.0/16" option
Setup Kubernetes network by installing Calico network plugin
Finally, look for
master Node status
Setup worker nodes
- Copy the
kudeadm joincommand from the output of
kubeadm initand run on the worker nodes to join them to the cluster.
- To regenerate
kubeadm joincommand output to join worker nodes run below command on master node & use the output to join the worker nodes.
Final status check of cluster
kubeadm get nodeson master node again to check the status of worker nodes
Find cluster information
As seen above in
kubectl cluster-info output our single control plane setup is complete & cluster is up and running with control plane master running on Node
master with ip https://126.96.36.199:6443 & KubeDNS is running at endpoint as mentioned above. Next, we can check the health of control plane components.
- Check the health status of various components of the control plane.
All the control plane components are up & in a healthy state.
As seen above
kubeadm has made single control plane setup a real easy & no-sweat job.
In the next article of the
kubeadm series we will discuss steps for setting up a HA Multimaster control plane.