Ansible playbook for kubeadm-based Kubernetes cluster installation on Linux
This Ansible playbook automates the installation and configuration of a Kubernetes cluster on Linux, with a single control plane node and multiple worker nodes, using the most recent stable Kubernetes release.
Suitable Environment : Development & Testing
System Requirements : Minimum 2 GB RAM & 2 vCPU
Supported Platforms : Baremetal, Virtual Machines, Cloud Instances
Supported Linux distributions :
- RedHat-based ( Fedora, RHEL, Rocky Linux, Almalinux, Oracle Linux )
- Debian-based ( Debian, Ubuntu )
- SUSE-based ( OpenSUSE, SLES )
Also, the latest stable versions of the following components will be installed.
- Container runtime : containerd
- Low-level container runtime : runc ( dependency for containerd )
- CNI plugin used : calico CNI
- Optionally, you can also install
- k8s CSI drivers :
Please install Ansible if you haven't already.
- Create a common Linux user on all nodes to be used for the cluster.
- Enable passwordless SSH authentication from the Ansible host to all cluster nodes.
- Ensure that the common user has sudo privileges without a password on all cluster nodes.
var_latest_version=$(curl -skL https://api.github.com/repos/Muthukumar-Subramaniam/install-k8s-on-linux/releases/latest | jq -r '.tag_name' 2>>/dev/null | tr -d '[:space:]')
wget https://github.com/Muthukumar-Subramaniam/install-k8s-on-linux/releases/download/${var_latest_version}/inst-k8s-ansible.tar.gz
tar -xzvf inst-k8s-ansible.tar.gz
cd inst-k8s-ansible



- Only private IP addresses, as defined in RFC 1918 are allowed.
- The deployment is configured to accept CIDR prefixes exclusively within the /16 to /28 range.
- Ensure that the selected CIDR prefix does not conflict with any existing networks in your infrastructure.
- Choose a CIDR prefix that provides sufficient address space for your cluster.
./setup.py

ansible-playbook inst-k8s-ansible.yaml -u <user-name>
Expected Outcome:

7) Once the Kubernetes cluster is successfully installed and ready, you can optionally install the following CSI drivers.
ansible-playbook optional-k8s-csi-nfs-driver.yaml -u <user-name>
ansible-playbook optional-k8s-csi-smb-driver.yaml -u <user-name>
- This playbook is a useful resource for experimenting with Kubernetes and can be customized to meet your specific requirements.
- The playbook utilizes the GitHub API to fetch the current stable versions of all required software components.
- Compatible with a wide range of Linux distributions.
- Your feedback and contributions are invaluable to the success of this project.
- Please report any bugs, suggest new features, or contribute directly to the codebase.