9251406426a4771dbf5f35f7e3fb3f3295137bcd
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
TuDatTr IaC
I do not recommend this project being used for ones own infrastructure, as this project is heavily attuned to my specific host/network setup
This Ansible project automates the setup of a K3s Kubernetes cluster on Proxmox VE. It also includes playbooks for configuring Docker hosts, load balancers, and other services.
Repository Structure
The repository is organized into the following main directories:
playbooks/: Contains the main Ansible playbooks for different setup scenarios.roles/: Contains the Ansible roles that are used by the playbooks.vars/: Contains variable files, including group-specific variables.
Playbooks
The following playbooks are available:
proxmox.yml: Provisions VMs and containers on Proxmox VE.k3s-servers.yml: Sets up the K3s master nodes.k3s-agents.yml: Sets up the K3s agent nodes.k3s-loadbalancer.yml: Configures a load balancer for the K3s cluster.k3s-storage.yml: Configures storage for the K3s cluster.docker.yml: Sets up Docker hosts and their load balancer.docker-host.yml: Configures the docker hosts.docker-lb.yml: Configures a load balancer for Docker services.kubernetes_setup.yml: A meta-playbook for setting up the entire Kubernetes cluster.
Roles
The following roles are defined:
common: Common configuration tasks for all nodes.proxmox: Manages Proxmox VE, including VM and container creation.k3s_server: Installs and configures K3s master nodes.k3s_agent: Installs and configures K3s agent nodes.k3s_loadbalancer: Configures an Nginx-based load balancer for the K3s cluster.k3s_storage: Configures storage solutions for Kubernetes.docker_host: Installs and configures Docker.kubernetes_argocd: Deploys Argo CD to the Kubernetes cluster.node_exporter: Installs the Prometheus Node Exporter for monitoring.reverse_proxy: Configures a Caddy-based reverse proxy.
Usage
-
Install dependencies:
pip install -r requirements.txt ansible-galaxy install -r requirements.yml -
Configure variables:
- Create an inventory file (e.g.,
vars/k3s.ini). - Adjust variables in
vars/group_vars/to match your environment.
- Create an inventory file (e.g.,
-
Run playbooks:
# To provision VMs on Proxmox ansible-playbook -i vars/proxmox.ini playbooks/proxmox.yml # To set up the K3s cluster ansible-playbook -i vars/k3s.ini playbooks/kubernetes_setup.yml
Disclaimer
This project is highly customized for the author's specific environment. Using it without modification is not recommended.
Description
Languages
Jinja
78.8%
Shell
21.2%