Added livenessProbe for local nginx apiserver proxy liveness probe (#4222)
* Added configurable local apiserver proxy liveness probe * Enable API LB healthcheck by default * Fix template spacing and moved healthz location to nginx http section * Fix healthcheck listen address to allow kubelet request healthcheck
This commit is contained in:
parent
0a3cf1a087
commit
669ab10c17
3 changed files with 21 additions and 2 deletions
|
@ -24,6 +24,8 @@ bin_dir: /usr/local/bin
|
||||||
## Local loadbalancer should use this port
|
## Local loadbalancer should use this port
|
||||||
## And must be set port 6443
|
## And must be set port 6443
|
||||||
nginx_kube_apiserver_port: 6443
|
nginx_kube_apiserver_port: 6443
|
||||||
|
## If nginx_kube_apiserver_healthcheck_port variable defined, enables proxy liveness check.
|
||||||
|
nginx_kube_apiserver_healthcheck_port: 8081
|
||||||
|
|
||||||
### OTHER OPTIONAL VARIABLES
|
### OTHER OPTIONAL VARIABLES
|
||||||
## For some things, kubelet needs to load kernel modules. For example, dynamic kernel services are needed
|
## For some things, kubelet needs to load kernel modules. For example, dynamic kernel services are needed
|
||||||
|
|
|
@ -25,6 +25,12 @@ spec:
|
||||||
memory: {{ nginx_memory_requests }}
|
memory: {{ nginx_memory_requests }}
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
|
{% if nginx_kube_apiserver_healthcheck_port is defined -%}
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: {{ nginx_kube_apiserver_healthcheck_port }}
|
||||||
|
{% endif -%}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /etc/nginx
|
- mountPath: /etc/nginx
|
||||||
name: etc-nginx
|
name: etc-nginx
|
||||||
|
|
|
@ -12,7 +12,7 @@ stream {
|
||||||
least_conn;
|
least_conn;
|
||||||
{% for host in groups['kube-master'] -%}
|
{% for host in groups['kube-master'] -%}
|
||||||
server {{ hostvars[host]['access_ip'] | default(hostvars[host]['ip'] | default(fallback_ips[host])) }}:{{ kube_apiserver_port }};
|
server {{ hostvars[host]['access_ip'] | default(hostvars[host]['ip'] | default(fallback_ips[host])) }}:{{ kube_apiserver_port }};
|
||||||
{% endfor %}
|
{% endfor -%}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
@ -22,5 +22,16 @@ stream {
|
||||||
proxy_connect_timeout 1s;
|
proxy_connect_timeout 1s;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
{% if nginx_kube_apiserver_healthcheck_port is defined -%}
|
||||||
|
server {
|
||||||
|
listen {{ nginx_kube_apiserver_healthcheck_port }};
|
||||||
|
location /healthz {
|
||||||
|
access_log off;
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{% endif -%}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue