Created
June 5, 2022 06:38
-
-
Save aussielunix/3a571ffd4e46536b8046b964434408a9 to your computer and use it in GitHub Desktop.
k3s nginx load balancer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
pid /run/nginx.pid; | |
worker_processes auto; | |
worker_rlimit_nofile 40000; | |
include /etc/nginx/modules-enabled/*.conf; | |
events { | |
worker_connections 8192; | |
} | |
stream { | |
upstream http_servers { | |
least_conn; | |
server <NODE_IP>:80 max_fails=3 fail_timeout=5s; | |
server <NODE_IP>:80 max_fails=3 fail_timeout=5s; | |
server <NODE_IP>:80 max_fails=3 fail_timeout=5s; | |
server <NODE_IP>:80 max_fails=3 fail_timeout=5s; | |
} | |
upstream https_servers { | |
least_conn; | |
server <NODE_IP>:443 max_fails=3 fail_timeout=5s; | |
server <NODE_IP>:443 max_fails=3 fail_timeout=5s; | |
server <NODE_IP>:443 max_fails=3 fail_timeout=5s; | |
server <NODE_IP>:443 max_fails=3 fail_timeout=5s; | |
} | |
upstream k3s_servers { | |
server <CONTROL_NODE_IP>:6443; | |
server <CONTROL_NODE_IP>:6443; | |
} | |
server { | |
listen 80; | |
proxy_pass http_servers; | |
} | |
server { | |
listen 443; | |
proxy_pass https_servers; | |
} | |
server { | |
listen 6443; | |
proxy_pass k3s_servers; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment