How to set up a multi-node Kubernetes local cluster for CKA, CKAD, CKS exams

Staz's photo
Staz
·May 16, 2022·

2 min read

How to set up a multi-node Kubernetes local cluster for CKA, CKAD, CKS exams

Subscribe to my newsletter and never miss my upcoming articles

Play this article

There are many ways to set up a Kubernetes cluster in a local environment, I have tested some tools and here I offer the best in my opinion, especially if your purpose is to practice for the CKA/CKAD/CKS certification exams.

We will need to create virtual machines on our PC/Laptop, for this I will use a Canonical product: Multipass. I have been using it for a long time and it is the best choice to create Ubuntu VMs in my opinion.

For cluster initialization, we will use kubeadm, as recommended in the official Kubernetes documentation.

Here I quote some reasons why it is better to use this stack against other options such as minikube, microk8s, k3s, RKE, EKS, AKS, GKE, and others:

  1. The main reason: No need to install Docker, you will use containerd as the container runtime, crictl as cli for CRI compliant container runtime and if you need to build a Dockerfile, you will use podman.

  2. There is no need to install extra dependencies on the Ubuntu VMs, what you need are clean nodes that only have what you need to work with.

  3. You need that your cluster to be clean as well, you do not need to install extra Kubernetes resources such as CRDs, statefulsets, daemons, services, deployments, among others.

  4. Multipass and Ubuntu were developed by Canonical, these have their support.

  5. You need to have full control of your cluster, especially your control plane node. That’s why Kubernetes managed services are useless (EKS, AKS, GKE, and others).

  6. You need Ubuntu nodes for simulating CKA/CKAD/CKS exams.

Requirements:

Make sure you have at least 4 GB of RAM,4 free CPU cores, and 20 Gb for VMs.

I recommend using these resources to avoid performance and disk space problems:

Control Plane (master node):

  • 2 Gb RAM
  • 2 CPU Core
  • 10 Gb Disk

Worker (worker node):

  • 2 Gb RAM
  • 2 CPU Core
  • 10 Gb Disk

Kubernetes Cluster Configuration

Without more to say here I attach a Git repository with the readme file where you can see the step by step for the Kubernetes cluster configuration:

github.com/stazdx/k8s-local-environment

Note: What is applied in this post is based on my experience, it isn’t the only way to be able to do it.

Happy coding!

Did you find this article valuable?

Support Staz by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
 
Share this