Skip to content

Ansible playbook for a kubeadm-based Kubernetes cluster installation on Linux (Red Hat, Debian, and SUSE-based distributions) with a single control plane node and multiple worker nodes for development and testing purposes.

License

Notifications You must be signed in to change notification settings

Muthukumar-Subramaniam/install-k8s-on-linux

Repository files navigation

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.

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.

Workflow:

1) Download the tarball for the most recent stable release of this Ansible project.

stable release

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

2) Update the host-control-plane file with the necessary hostname.

Screenshot-host-control-plane-file

3) Update the host-workers file with the necessary hostnames.

Screenshot-host-workers-file

4) Update the pod-network-cidr file with the desired pod network CIDR.

Screenshot-pod-network-cidr-file
  • 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.

5) Run the setup.py script to prepare the environment for the Ansible playbook.

./setup.py
Screenshot-setup-script-run

6) Run the playbook if the setup.py script completes successfully.

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

Expected Outcome:

Screenshot-end-output-of-playbook-run

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>

Kindly note:

  • 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.

Have lots of fun!

About

Ansible playbook for a kubeadm-based Kubernetes cluster installation on Linux (Red Hat, Debian, and SUSE-based distributions) with a single control plane node and multiple worker nodes for development and testing purposes.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published