How to Install kubeadm on Ubuntu 24.04 LTS via Shell Script Method – Secure & Step-by-Step Kubernetes Cluster Setup
Introduction Kubernetes has become the go-to orchestration tool for managing containerized applications in production. One of the fastest ways to set up a Kubernetes cluster is by using kubeadm.In this tutorial, we will set up a Kubernetes cluster on Ubuntu 24.04 LTS using automated shell scripts — making the process faster, error-free, and repeatable for both lab and production environments. Whether you are a DevOps student, system administrator, or cloud engineer, this guide will help you deploy Kubernetes quickly on AWS EC2, Virtual Machines, or bare metal servers. Prerequisites for Kubernetes Cluster Setup Requirement Description Number of Nodes 1 Master Node, 1 or more Worker Nodes OS Version Ubuntu 24.04 LTS (64-bit) CPU Minimum 2 vCPUs (Master), 1 vCPU (Worker) RAM Minimum 4GB RAM (Master), 2GB RAM (Worker) Disk Space Minimum 20GB free space Network All nodes should be in the same network/subnet Access sudo privileges and internet access on all nodes Security Ports for Kubernetes Setup When setting up Kubernetes, make sure the following ports are opened in your AWS Security Group or cloud provider firewall.No need to run commands on the server — these are network-level configurations. Port Protocol Purpose 6443 TCP Kubernetes API server 2379-2380 TCP etcd server client API 10250 TCP Kubelet API 10251 TCP kube-scheduler 10252 TCP kube-controller-manager 10255 TCP Read-only Kubelet API 30000-32767 TCP NodePort services Step-by-Step Installation via Shell Script We will use three scripts: 1. Master Node Installation Script Run this on Master Node Only Create the file: Paste the following script: Run the script: 2. Worker Node Installation Script Run this on Worker Node Only Create the file: Paste the following script: Run the script: 3. Uninstall Script (All Nodes) Create the file: Paste: Run the script: Conclusion By using these shell scripts, you can automate the entire Kubernetes installation process on Ubuntu 24.04 LTS — saving time and reducing manual errors. This method is perfect for classroom labs, AWS setups, or production environments. If you have questions, feedback, or need support, feel free to reach out at: 📧 devopsbyrushi@gmail.com If you want, I can now add diagrams for Master-Worker communication & port usage so your blog looks even more professional and SEO-rich.Do you want me to prepare those visuals?
