CKA Learning Series: Build K8s Cluster using Kubeadm in minutes !

CKA

CKA 2020 Exam Updates(Sep onwards)

CKA exam, tests your skills in specific domains of k8s platform. Creating/managing k8s cluster using kubeadm is one of primary requirement. I have recently passed this exam and In my opinion practising on kubeadm based cluster can help you to cover a big part of exam syllabus. I suggest create your own cluster using kubeadm and practise as much as possible to get through in first attempt. This blogpost is part of series which I will be publishing in coming days to help you pass the exam.

https://training.linuxfoundation.org/cka-program-changes-2020/

In this post we will cover the part in which we are building a k8s cluster using kubeadm.

What you need to start -

Free cloud account or Virtual Box
3 VMs

I am using 3 VMs named —

  • node-1 [Ubuntu 18.x machine / master or controlplane]
  • node-2 [Ubuntu 18.x machine / worker]
  • node-3 [Ubuntu 18.x machine / worker]

What are the steps -

Perform these steps on all 3 VMs. These steps deploy required component for building k8s cluster using kubeadm.

Step 1: Configure iptables to receive bridged network traffic

Step 2: Make sure you have installed ebtables and ethtool. If not please install

Step 3: Install HTTPS-TRANSPORT component

Step 4: Install docker

Step 5: Add K8s repo in system

Step 6: Install Kubeadm,Kubelet and Kubectl

Step 7: If you want kubeadm cluster process fast then pull required Images in advance which will be used for controlplane. [required on master node ], otherwise you can ignore !

Time to create cluster -

VMs are ready, select 1 VM which we need to prepare as a master node [k8s controlplane] and others we will prepare as a worked node. In this case I will use node-1 as a master and node-2/3 as a worker node.

Initialise Cluster

kubeadm init command

Thats it ! Isn’t it the simplest way to deploy a k8s cluster. Your master node is getting ready now. To start using it, you can see the 3 steps mentioned in the output. Run it !

List the status of control-plane pods. If you would have pulled image in advance, you could have avoided this delay :)

Now Node-1 as a master is ready, please run the join command mentioned above as an output of create cluster command on other worker nodes. Join command adds worker node as part of cluster.

[node-2, node-3]

Did you see NotReady status on nodes ? It is because you missed to install pod network. [I miss this intentionally to help you understand troubleshooting of cluster which is an essential topic of CKA ]

Lets Install Pod Network, we will use Weave as a pod network solution. Please note there are multiple solutions so you can use anyone as per your requirement.

Once done check the status again on cluster.

Voila ! Cluster is ready for use :)

If by any chance you miss to copy that join command ! Don’t worry, we have solution.

to avoid above hustle, we have one more simple solution, run following command —

But knowing things in details will not bite anyone.

Once your cluster is ready, you can start using it immediately. I have consolidated few commands which can help you as well.

In quest of understanding How Systems Work !

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store