refactor(k3s): enhance cluster setup and enable ArgoCD apps

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2025-07-22 07:23:09 +02:00
parent e1a2248154
commit 976cad51e2
38 changed files with 401 additions and 234 deletions

View File

@@ -9,8 +9,6 @@
become: true
notify:
- Restart nginx
vars:
k3s_server_ips: "{{ k3s_primary_server_ip }}"
- name: Enable nginx
ansible.builtin.systemd:

View File

@@ -4,6 +4,14 @@
update_cache: true
become: true
- name: Install dependencies for apt to use repositories over HTTPS
ansible.builtin.apt:
name: "{{ item }}"
state: present
loop:
- qemu-guest-agent
become: true
- name: Install Nginx
ansible.builtin.apt:
name:

View File

@@ -1,6 +1,7 @@
---
- name: Installation
ansible.builtin.include_tasks: installation.yml
- name: Configure
ansible.builtin.include_tasks: configuration.yml

View File

@@ -3,11 +3,10 @@ include /etc/nginx/modules-enabled/*.conf;
events {}
stream {
# TCP Load Balancing for the K3s API
upstream k3s_servers {
{% for ip in k3s_server_ips %}
{% for ip in k3s_server_ips %}
server {{ ip }}:{{ k3s.loadbalancer.default_port }};
{% endfor %}
{% endfor %}
}
server {
@@ -15,10 +14,22 @@ stream {
proxy_pass k3s_servers;
}
upstream etcd_servers {
{% for ip in k3s_server_ips %}
server {{ ip }}:2379;
{% endfor %}
}
server {
listen 2379;
proxy_pass etcd_servers;
}
upstream dns_servers {
{% for ip in k3s_server_ips %}
{% for ip in k3s_server_ips %}
server {{ ip }}:53;
{% endfor %}
{% endfor %}
}
server {