Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muthukumar-subramaniam/install-k8s-on-linux
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.
https://github.com/muthukumar-subramaniam/install-k8s-on-linux
almalinux ansible ansible-playbook ansible-playbooks debian fedora kubernetes kubernetes-cluster kubernetes-deployment kubernetes-setup linux opensuse oraclelinux rhel rockylinux sles suse ubuntu
Last synced: 21 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/muthukumar-subramaniam/install-k8s-on-linux
- Owner: Muthukumar-Subramaniam
- License: gpl-3.0
- Created: 2024-09-03T04:05:23.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-10-13T03:57:53.000Z (23 days ago)
- Last Synced: 2024-10-15T16:42:29.061Z (21 days ago)
- Topics: almalinux, ansible, ansible-playbook, ansible-playbooks, debian, fedora, kubernetes, kubernetes-cluster, kubernetes-deployment, kubernetes-setup, linux, opensuse, oraclelinux, rhel, rockylinux, sles, suse, ubuntu
- Language: Python
- Homepage: https://ansiblek8s.blogspot.com
- Size: 2.09 MB
- Stars: 39
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [Ansible](https://www.ansible.com/) playbook for kubeadm-based [Kubernetes](https://kubernetes.io/) 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](https://github.com/kubernetes/kubernetes/releases/latest).
We 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.**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 )#### Prerequisites:
* 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.
* Prepare the cluster nodes by installing any of the above mentioned supported Linux distributions, even with a minimal installation.
* 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.
* Create a common Linux user on all cluster nodes, which will be used for the cluster installation.
* Enable passwordless SSH authentication from the Ansible host to all cluster nodes using the common user created earlier.
* Ensure the common user has passwordless sudo privileges on all cluster nodes.
#### The main playbook installs and configures the latest stable versions of the following required components.
* Container orchestrator: [kubernetes](https://github.com/kubernetes/kubernetes)
* Container runtime: [containerd](https://github.com/containerd/containerd)
* Low-level container runtime: [runc](https://github.com/opencontainers/runc) ( dependency for containerd )
* CNI plugin: [calico](https://github.com/projectcalico/calico)#### Optional playbooks are available to install the following components once the cluster is ready.
* [csi-driver-nfs](https://github.com/kubernetes-csi/csi-driver-nfs)
* [csi-driver-smb](https://github.com/kubernetes-csi/csi-driver-smb)
* [MetalLB](https://github.com/metallb/metallb) LoadBalancer----
### Step-by-Step Workflow:
#### Step 1) Copy and execute the below command snippet to extract the tarball for the most recent stable release of this Ansible project.
[![stable release](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Muthukumar-Subramaniam/install-k8s-on-linux/main/inst-k8s-ansible/playbook_version.json)](https://github.com/Muthukumar-Subramaniam/install-k8s-on-linux/releases/latest)
```
curl -sSL https://github.com/Muthukumar-Subramaniam/install-k8s-on-linux/releases/latest/download/inst-k8s-ansible.tar.gz | tar -xzvf - && cd inst-k8s-ansible
```
#### Step 2) Update the host-control-plane file with the necessary hostname.
#### Step 3) Update the host-workers file with the necessary hostnames.
#### Step 4) Update the pod-network-cidr file with the desired pod network CIDR.
* Only private IP addresses, as defined in [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) 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.#### Step 5) Run the setup.py script to prepare the environment for the Ansible playbook.
```
./setup.py
```
#### Step 6) Run the playbook if the setup.py script completes successfully.
```
./inst-k8s-ansible.yaml
```
Expected Outcome:
### Great work! Your cluster is now ready to use.
#### Optional Step 1) To install CSI NFS Driver for the kubernetes cluster if required.
```
./optional-k8s-csi-nfs-driver.yaml
```
Expected Outcome:
#### Optional Step 2) To install CSI SMB Driver for the kubernetes cluster if required.
```
./optional-k8s-csi-smb-driver.yaml
```
Expected Outcome:
#### Optional Step 3) To install MetalLB loadbalancer for the kubernetes cluster if required.
Note: Please make sure to change the address pool range in the playbook as per your environment and requirement.
```
./optional-install-metallb.yaml
```
Expected Outcome:
### That's all for now! Your trust and engagement means a lot, and we hope you find the playbook useful.
### 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!