Skip to content

Instantly share code, notes, and snippets.

@aussielunix
Created June 5, 2022 06:38
Show Gist options
  • Select an option

  • Save aussielunix/3a571ffd4e46536b8046b964434408a9 to your computer and use it in GitHub Desktop.

Select an option

Save aussielunix/3a571ffd4e46536b8046b964434408a9 to your computer and use it in GitHub Desktop.

Revisions

  1. aussielunix created this gist Jun 5, 2022.
    47 changes: 47 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    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;
    }
    }