ansible/roles/loadbalancer/templates/nginx.conf.j2

32 lines
506 B
Django/Jinja

include /etc/nginx/modules-enabled/*.conf;
events {}
stream {
upstream k3s_servers {
{% for ip in k3s_server_ips %}
server {{ ip }}:{{k3s.loadbalancer.default_port}};
{% endfor %}
}
server {
listen {{k3s.loadbalancer.default_port}};
proxy_pass k3s_servers;
}
}
http {
upstream k3s_servers_http {
least_conn;
{% for ip in k3s_server_ips %}
server {{ ip }};
{% endfor %}
}
server {
location / {
proxy_pass http://k3s_servers_http;
}
}
}