Skip to content

Instantly share code, notes, and snippets.

@CalvinHartwell
Created September 11, 2018 13:22
Show Gist options
  • Select an option

  • Save CalvinHartwell/fc11689a85663d3f4651c791dc6dd257 to your computer and use it in GitHub Desktop.

Select an option

Save CalvinHartwell/fc11689a85663d3f4651c791dc6dd257 to your computer and use it in GitHub Desktop.
nginx kube api lb
ubuntu@ip-172-31-42-113:/etc/nginx/sites-enabled$ ls
apilb
ubuntu@ip-172-31-42-113:/etc/nginx/sites-enabled$ cat apilb
upstream target_service {
server 172.31.38.154:6443;
server 172.31.19.2:6443;
}
server {
listen 443 ssl http2;
server_name _;
access_log /var/log/nginx.access.log;
error_log /var/log/nginx.error.log;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_certificate /srv/kubernetes/server.crt;
ssl_certificate_key /srv/kubernetes/server.key;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
location / {
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto-Version $http2;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Stream-Protocol-Version $http_x_stream_protocol_version;
add_header X-Stream-Protocol-Version $upstream_http_x_stream_protocol_version;
proxy_pass https://target_service;
proxy_read_timeout 90;
}
}ubuntu@ip-172-31-42-113:/etc/nginx/sites-enabled$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment