2024-09-19 23:10:00 +02:00
|
|
|
include /etc/nginx/modules-enabled/*.conf;
|
|
|
|
|
|
|
|
events {}
|
|
|
|
|
|
|
|
stream {
|
2024-10-04 00:00:02 +02:00
|
|
|
# TCP Load Balancing for the K3s API
|
2024-09-19 23:10:00 +02:00
|
|
|
upstream k3s_servers {
|
|
|
|
{% for ip in k3s_server_ips %}
|
2024-09-20 16:57:59 +02:00
|
|
|
server {{ ip }}:{{k3s.loadbalancer.default_port}};
|
2024-09-19 23:10:00 +02:00
|
|
|
{% endfor %}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2024-09-20 16:57:59 +02:00
|
|
|
listen {{k3s.loadbalancer.default_port}};
|
2024-09-19 23:10:00 +02:00
|
|
|
proxy_pass k3s_servers;
|
|
|
|
}
|
2024-10-04 00:00:02 +02:00
|
|
|
|
|
|
|
upstream dns_servers {
|
|
|
|
{% for ip in k3s_server_ips %}
|
|
|
|
server {{ ip }}:53;
|
|
|
|
{% endfor %}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 53 udp;
|
|
|
|
proxy_pass dns_servers;
|
|
|
|
}
|
2024-09-19 23:10:00 +02:00
|
|
|
}
|
2024-09-30 07:51:33 +02:00
|
|
|
|
|
|
|
http {
|
2024-09-30 10:46:19 +02:00
|
|
|
upstream k3s_servers_http {
|
|
|
|
least_conn;
|
|
|
|
{% for ip in k3s_server_ips %}
|
2024-09-30 20:06:27 +02:00
|
|
|
server {{ ip }}:80;
|
|
|
|
{% endfor %}
|
|
|
|
}
|
|
|
|
|
|
|
|
upstream k3s_servers_https {
|
|
|
|
least_conn;
|
|
|
|
{% for ip in k3s_server_ips %}
|
|
|
|
server {{ ip }}:443;
|
2024-09-30 10:46:19 +02:00
|
|
|
{% endfor %}
|
2024-09-30 07:51:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2024-09-30 20:06:27 +02:00
|
|
|
listen 80;
|
|
|
|
|
2024-09-30 07:51:33 +02:00
|
|
|
location / {
|
2024-09-30 10:46:19 +02:00
|
|
|
proxy_pass http://k3s_servers_http;
|
2024-09-30 10:53:18 +02:00
|
|
|
proxy_set_header Host $http_host;
|
2024-09-30 20:06:27 +02:00
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto http;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2024-10-04 00:00:02 +02:00
|
|
|
listen 443 ssl;
|
2024-09-30 20:06:27 +02:00
|
|
|
|
2024-10-04 00:00:02 +02:00
|
|
|
server_name staging.k3s.seyshiro.de *.staging.k3s.seyshiro.de;
|
2024-10-03 17:38:08 +02:00
|
|
|
|
|
|
|
ssl_certificate /etc/nginx/ssl/staging_tls.crt;
|
|
|
|
ssl_certificate_key /etc/nginx/ssl/staging_tls.key;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
proxy_pass https://k3s_servers_https;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2024-10-04 00:00:02 +02:00
|
|
|
listen 443 ssl;
|
2024-10-03 17:38:08 +02:00
|
|
|
|
2024-10-04 00:00:02 +02:00
|
|
|
server_name k3s.seyshiro.de *.k3s.seyshiro.de;
|
2024-10-03 17:38:08 +02:00
|
|
|
|
|
|
|
ssl_certificate /etc/nginx/ssl/production_tls.crt;
|
|
|
|
ssl_certificate_key /etc/nginx/ssl/production_tls.key;
|
|
|
|
|
2024-09-30 20:06:27 +02:00
|
|
|
location / {
|
|
|
|
proxy_pass https://k3s_servers_https;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto https;
|
2024-09-30 10:46:19 +02:00
|
|
|
}
|
2024-09-30 07:51:33 +02:00
|
|
|
}
|
|
|
|
}
|
2024-10-04 00:00:02 +02:00
|
|
|
|
|
|
|
|