Kubernetes install using kubeadm on AWS EC2

BalaSubramani K
KUBELANCER PRIVATE LIMITED
2 min readJun 19, 2024

Here, we are using kubeadm to create a cluster with a single master and two worker nodes by using AWS EC2 machines.

Pr-Requisite

  • Machines — EC2 or Equivalent servers / VM
  • Minimum 2 GB of RAM per machine.
  • At least 2 CPUs for Control Plane.
  • Full network connectivity between all machines in the cluster.
  • Certain ports are open on your machines. See the official documentation for a detailed port listing.
  • Swap disabled. You MUST disable swap in order for the kubelet to work properly.

Kubeadm Port Requirements

Provision Servers / VM

  • Provision 1 EC2 Ubuntu 22 machines (t2.medium) on AWS — Label its as Master
  • Provision 2 EC2 Ubuntu 22 machines (t2.small) on AWS — Label its as worker {1,2}

Clone the script to all the nodes

https://github.com/kubelancer/CKA-2024/tree/develop/scripts

git clone https://github.com/kubelancer/CKA-2024

Move to the script directory

# cd scripts

Install the pre-requsites to all the nodes

# sh 1-install_master_k8s_v29.sh

Install CNI Plugin-Calico on master node

  # sh 2-master_kubeadm_init_cni_calico.sh

Execute the join command in worker nodes

(Replace with your token output)

# sudo kubeadm join 172.31.28.104:6443 --token cpptk8.chzo4d71c5adgfyy --discovery-token-ca-cert-hash sha256:04bc021cb098e348bf880759698e32343f7ee851af3fb34281e25c7e3d4f051f

Label the nodes

# kubectl label node worker1 node-role.kubernetes.io/worker=worker1
# kubectl label node worker2 node-role.kubernetes.io/worker=worker2

--

--

BalaSubramani K
KUBELANCER PRIVATE LIMITED

Senior Cloud and DevOps Infrastructure Engineer | Multi-Cloud Solution Architect | Consultant | Containerization | Cloud Native | Mobile | Serverless