2016-09-28 19:05:08 +08:00
|
|
|
error_log stderr notice;
|
|
|
|
|
2019-04-08 17:02:29 +08:00
|
|
|
worker_processes 2;
|
|
|
|
worker_rlimit_nofile 130048;
|
|
|
|
worker_shutdown_timeout 10s;
|
|
|
|
|
2016-09-28 19:05:08 +08:00
|
|
|
events {
|
|
|
|
multi_accept on;
|
|
|
|
use epoll;
|
2019-04-08 17:02:29 +08:00
|
|
|
worker_connections 16384;
|
2016-09-28 19:05:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
stream {
|
2019-04-08 17:02:29 +08:00
|
|
|
upstream kube_apiserver {
|
|
|
|
least_conn;
|
2021-03-24 08:26:05 +08:00
|
|
|
{% for host in groups['kube_control_plane'] -%}
|
2019-04-08 17:02:29 +08:00
|
|
|
server {{ hostvars[host]['access_ip'] | default(hostvars[host]['ip'] | default(fallback_ips[host])) }}:{{ kube_apiserver_port }};
|
|
|
|
{% endfor -%}
|
|
|
|
}
|
2016-09-28 19:05:08 +08:00
|
|
|
|
2019-04-08 17:02:29 +08:00
|
|
|
server {
|
2019-04-11 03:20:08 +08:00
|
|
|
listen 127.0.0.1:{{ loadbalancer_apiserver_port|default(kube_apiserver_port) }};
|
2019-04-08 17:02:29 +08:00
|
|
|
proxy_pass kube_apiserver;
|
|
|
|
proxy_timeout 10m;
|
|
|
|
proxy_connect_timeout 1s;
|
|
|
|
}
|
2019-03-28 21:20:46 +08:00
|
|
|
}
|
2016-09-28 19:05:08 +08:00
|
|
|
|
2019-03-28 21:20:46 +08:00
|
|
|
http {
|
2019-04-08 17:02:29 +08:00
|
|
|
aio threads;
|
|
|
|
aio_write on;
|
|
|
|
tcp_nopush on;
|
|
|
|
tcp_nodelay on;
|
|
|
|
|
2019-09-05 15:32:51 +08:00
|
|
|
keepalive_timeout {{ loadbalancer_apiserver_keepalive_timeout }};
|
2019-04-08 17:02:29 +08:00
|
|
|
keepalive_requests 100;
|
|
|
|
reset_timedout_connection on;
|
|
|
|
server_tokens off;
|
|
|
|
autoindex off;
|
|
|
|
|
2019-04-10 20:56:18 +08:00
|
|
|
{% if loadbalancer_apiserver_healthcheck_port is defined -%}
|
2019-04-08 17:02:29 +08:00
|
|
|
server {
|
2019-04-10 20:56:18 +08:00
|
|
|
listen {{ loadbalancer_apiserver_healthcheck_port }};
|
2019-04-08 17:02:29 +08:00
|
|
|
location /healthz {
|
|
|
|
access_log off;
|
|
|
|
return 200;
|
|
|
|
}
|
2019-07-02 04:38:37 +08:00
|
|
|
location /stub_status {
|
|
|
|
stub_status on;
|
|
|
|
access_log off;
|
|
|
|
}
|
2019-04-08 17:02:29 +08:00
|
|
|
}
|
2019-04-10 20:56:18 +08:00
|
|
|
{% endif %}
|
2016-09-28 19:05:08 +08:00
|
|
|
}
|