{"id":15043049,"url":"https://github.com/muthukumar-subramaniam/install-k8s-on-linux","last_synced_at":"2025-06-13T20:35:24.761Z","repository":{"id":255847005,"uuid":"851417055","full_name":"Muthukumar-Subramaniam/install-k8s-on-linux","owner":"Muthukumar-Subramaniam","description":"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.","archived":false,"fork":false,"pushed_at":"2025-03-26T12:32:19.000Z","size":2315,"stargazers_count":52,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-14T20:55:16.808Z","etag":null,"topics":["almalinux","ansible","ansible-playbook","ansible-playbooks","debian","fedora","kubernetes","kubernetes-cluster","kubernetes-deployment","kubernetes-setup","linux","opensuse","oraclelinux","rhel","rockylinux","sles","suse","ubuntu"],"latest_commit_sha":null,"homepage":"https://ansiblek8s.blogspot.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Muthukumar-Subramaniam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["Muthukumar-Subramaniam"]}},"created_at":"2024-09-03T04:05:23.000Z","updated_at":"2025-03-26T12:32:23.000Z","dependencies_parsed_at":"2025-03-26T13:29:24.597Z","dependency_job_id":"a5aa1cef-0abd-4d85-a386-ba20a7dfdf1e","html_url":"https://github.com/Muthukumar-Subramaniam/install-k8s-on-linux","commit_stats":null,"previous_names":["muthukumar-subramaniam/install-k8s-on-linux"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/Muthukumar-Subramaniam/install-k8s-on-linux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muthukumar-Subramaniam%2Finstall-k8s-on-linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muthukumar-Subramaniam%2Finstall-k8s-on-linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muthukumar-Subramaniam%2Finstall-k8s-on-linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muthukumar-Subramaniam%2Finstall-k8s-on-linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Muthukumar-Subramaniam","download_url":"https://codeload.github.com/Muthukumar-Subramaniam/install-k8s-on-linux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muthukumar-Subramaniam%2Finstall-k8s-on-linux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259716479,"owners_count":22900891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["almalinux","ansible","ansible-playbook","ansible-playbooks","debian","fedora","kubernetes","kubernetes-cluster","kubernetes-deployment","kubernetes-setup","linux","opensuse","oraclelinux","rhel","rockylinux","sles","suse","ubuntu"],"created_at":"2024-09-24T20:48:30.274Z","updated_at":"2025-06-13T20:35:24.741Z","avatar_url":"https://github.com/Muthukumar-Subramaniam.png","language":"Python","funding_links":["https://github.com/sponsors/Muthukumar-Subramaniam"],"categories":[],"sub_categories":[],"readme":"# [Ansible](https://www.ansible.com/) playbook for kubeadm-based [Kubernetes](https://kubernetes.io/) cluster installation on Linux  \n\n----  \n\nThis 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](https://github.com/kubernetes/kubernetes/releases/latest).  \nWe understand that there’s Kubespray, which is much more powerful and allows for a lot of customizations, but this playbook is lightweight and simple. It might be a good option for those looking to set up a quick and easy development and testing environment of Kubernetes on Linux.  \n\n**Suitable Environment:** Development \u0026 Testing\n\n**System Requirements:** Minimum 2 GB RAM \u0026 2 vCPU\n\n**Supported Platforms:** Baremetal, Virtual Machines, Cloud Instances\n\n#### Supported Linux distributions: \n* RedHat-based ( Fedora, RHEL, Rocky Linux, Almalinux, Oracle Linux ) \n* Debian-based  ( Debian, Ubuntu )\n* SUSE-based  ( OpenSUSE, SLES )\n\n#### Prerequisites:\n* Please [install Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) on the machine where you plan to run the playbook if you haven’t done so already.\n* Prepare the cluster nodes by installing any of the above mentioned supported Linux distributions, even with a minimal installation.\n* Please ensure that you have DNS set up that resolves all the involved hosts, or update the host files on all hosts with the necessary entries for each involved host.\n* Create a common Linux user on all cluster nodes, which will be used for the cluster installation.\n* Enable passwordless SSH authentication from the Ansible host to all cluster nodes using the common user created earlier.  \n* Ensure the common user has passwordless sudo privileges on all cluster nodes.\n \n#### The main playbook installs and configures the latest stable versions of the following required components.   \n* Container orchestrator: [kubernetes](https://github.com/kubernetes/kubernetes)\n* Container runtime: [containerd](https://github.com/containerd/containerd)  \n* Low-level container runtime: [runc](https://github.com/opencontainers/runc) ( dependency for containerd )  \n* CNI plugin: [calico](https://github.com/projectcalico/calico)\n\n#### Optional playbooks are available to install the following components once the cluster is ready.  \n* [csi-driver-nfs](https://github.com/kubernetes-csi/csi-driver-nfs)\n* [csi-driver-smb](https://github.com/kubernetes-csi/csi-driver-smb)\n* [MetalLB](https://github.com/metallb/metallb) LoadBalancer\n\n----\n\n### Step-by-Step Workflow:    \n\n#### Step 1) Copy and execute the below command snippet to extract the tarball for the most recent stable release of this Ansible project.  \n   [![stable release](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Muthukumar-Subramaniam/install-k8s-on-linux/main/playbook_version.json)](https://github.com/Muthukumar-Subramaniam/install-k8s-on-linux/releases/latest)\n   ```\n   curl -sSL https://github.com/Muthukumar-Subramaniam/install-k8s-on-linux/releases/latest/download/inst-k8s-ansible.tar.gz | tar -xzvf - \u0026\u0026 cd inst-k8s-ansible\n   ```\n#### Step 2) Update the host-control-plane file with the necessary hostname.  \n   \n   \u003cimg width=\"362\" alt=\"Screenshot-host-control-plane-file\" src=\"https://github.com/user-attachments/assets/ff689ceb-554a-438b-83e4-efd0b19e0170\"\u003e\n  \n#### Step 3) Update the host-workers file with the necessary hostnames.  \n   \n   \u003cimg width=\"340\" alt=\"Screenshot-host-workers-file\" src=\"https://github.com/user-attachments/assets/ec9b0598-9502-4ba2-ac52-9254e9093500\"\u003e\n\n#### Step 4) Update the pod-network-cidr file with the desired pod network CIDR.  \n   \n   \u003cimg width=\"354\" alt=\"Screenshot-pod-network-cidr-file\" src=\"https://github.com/user-attachments/assets/92aaab26-f9a1-43fe-830f-a56ed19eba0a\"\u003e\n  \n   * Only private IP addresses, as defined in [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) are allowed.  \n   * The deployment is configured to accept CIDR prefixes exclusively within the /16 to /28 range.   \n   * Ensure that the selected CIDR prefix does not conflict with any existing networks in your infrastructure.  \n   * Choose a CIDR prefix that provides sufficient address space for your cluster.  \n\n#### Step 5) Run the setup.py script to prepare the environment for the Ansible playbook.  \n   ```\n   ./setup.py\n   ```\n   \u003cimg width=\"497\" alt=\"Screenshot-setup-script-run\" src=\"https://github.com/user-attachments/assets/40cd5400-457b-4428-89b4-8d5d43690f6c\"\u003e\n\n#### Step 6) Run the playbook if the setup.py script completes successfully.  \n   ```\n   ./inst-k8s-ansible.yaml\n   ```\n   Expected Outcome:  \n\n   \u003cimg width=\"695\" alt=\"Screenshot-end-output-of-playbook-run\" src=\"https://github.com/user-attachments/assets/363a8107-0a08-4cda-996f-cb5e8fb9e7bd\" /\u003e\n\n### Great work! Your cluster is now ready to use.  \n   \n#### Optional Step 1) To install CSI NFS Driver for the kubernetes cluster if required.\n   ```\n   ./optional-k8s-csi-nfs-driver.yaml\n   ```\n  Expected Outcome:  \n  \n  \u003cimg width=\"702\" alt=\"Screenshot-csi-driver-nfs\" src=\"https://github.com/user-attachments/assets/40732420-acd2-4a09-94d8-128ac44634ce\"\u003e  \n\n#### Optional Step 2) To install CSI SMB Driver for the kubernetes cluster if required.  \n   ```\n   ./optional-k8s-csi-smb-driver.yaml\n   ```\n   Expected Outcome:  \n\n   \u003cimg width=\"694\" alt=\"Screenshot-csi-driver-smb\" src=\"https://github.com/user-attachments/assets/595d50a9-19d8-474c-97bd-e6ee72c09584\"\u003e\n\n#### Optional Step 3) To install MetalLB loadbalancer for the kubernetes cluster if required.    \n   Note: Please make sure to change the address pool range in the playbook as per your environment and requirement. \n\n   \u003cimg width=\"634\" alt=\"Screenshot-metallb-ip-pool\" src=\"https://github.com/user-attachments/assets/c59970f3-c28d-41d2-b906-ca891dce0ce1\"\u003e\n\n   ```\n   ./optional-install-metallb.yaml\n   ```\n   Expected Outcome:  \n\n   \u003cimg width=\"699\" alt=\"Screenshot-metallb\" src=\"https://github.com/user-attachments/assets/ca42347a-9b44-43af-9aa2-229713a11192\"\u003e\n\n### That's all for now! Your trust and engagement means a lot, and we hope you find the playbook useful.\n\n### Kindly note:  \n* This playbook is a useful resource for experimenting with Kubernetes and can be customized to meet your specific requirements.    \n* The playbook utilizes the GitHub API to fetch the current stable versions of all required software components.  \n* Compatible with a wide range of Linux distributions.  \n* Your feedback and contributions are invaluable to the success of this project.  \n* Please report any bugs, suggest new features, or contribute directly to the codebase.  \n\n### Have lots of fun!  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuthukumar-subramaniam%2Finstall-k8s-on-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuthukumar-subramaniam%2Finstall-k8s-on-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuthukumar-subramaniam%2Finstall-k8s-on-linux/lists"}