Browse Source
use nginx proxy on non-master nodes to proxy apiserver traffic
use nginx proxy on non-master nodes to proxy apiserver traffic
Also adds all masters by hostname and localhost/127.0.0.1 to apiserver SSL certificate. Includes documentation update on how localhost loadbalancer works.pull/528/head
Matthew Mosesohn
8 years ago
13 changed files with 129 additions and 47 deletions
Split View
Diff Options
-
BINdocs/figures/loadbalancer_localhost.png
-
56docs/ha-mode.md
-
5inventory/group_vars/all.yml
-
3roles/kubernetes/node/defaults/main.yml
-
3roles/kubernetes/node/tasks/main.yml
-
9roles/kubernetes/node/tasks/nginx-proxy.yml
-
20roles/kubernetes/node/templates/manifests/nginx-proxy.manifest.j2
-
26roles/kubernetes/node/templates/nginx.conf.j2
-
2roles/kubernetes/preinstall/defaults/main.yml
-
8roles/kubernetes/preinstall/tasks/set_facts.yml
-
7roles/kubernetes/secrets/files/make-ssl.sh
-
27roles/kubernetes/secrets/tasks/gen_certs.yml
-
10roles/kubernetes/secrets/templates/openssl.conf.j2
@ -0,0 +1,9 @@ |
|||
--- |
|||
- name: nginx-proxy | Write static pod |
|||
template: src=manifests/nginx-proxy.manifest.j2 dest=/etc/kubernetes/manifests/nginx-proxy.yml |
|||
|
|||
- name: nginx-proxy | Make nginx directory |
|||
file: path=/etc/nginx state=directory mode=0700 owner=root |
|||
|
|||
- name: nginx-proxy | Write nginx-proxy configuration |
|||
template: src=nginx.conf.j2 dest="/etc/nginx/nginx.conf" owner=root mode=0755 backup=yes |
@ -0,0 +1,20 @@ |
|||
apiVersion: v1 |
|||
kind: Pod |
|||
metadata: |
|||
name: nginx-proxy |
|||
namespace: kube-system |
|||
spec: |
|||
hostNetwork: true |
|||
containers: |
|||
- name: nginx-proxy |
|||
image: {{ nginx_image_repo }}:{{ nginx_image_tag }} |
|||
securityContext: |
|||
privileged: true |
|||
volumeMounts: |
|||
- mountPath: /etc/nginx |
|||
name: etc-nginx |
|||
readOnly: true |
|||
volumes: |
|||
- name: etc-nginx |
|||
hostPath: |
|||
path: /etc/nginx |
@ -0,0 +1,26 @@ |
|||
error_log stderr notice; |
|||
|
|||
worker_processes auto; |
|||
events { |
|||
multi_accept on; |
|||
use epoll; |
|||
worker_connections 1024; |
|||
} |
|||
|
|||
stream { |
|||
upstream kube_apiserver { |
|||
least_conn; |
|||
{% for host in groups['kube-master'] -%} |
|||
server {{ hostvars[host]['access_ip'] | default(hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address'])) }}:{{ kube_apiserver_port }}; |
|||
{% endfor %} |
|||
} |
|||
|
|||
server { |
|||
listen {{ kube_apiserver_port }}; |
|||
proxy_pass kube_apiserver; |
|||
proxy_timeout 3s; |
|||
proxy_connect_timeout 1s; |
|||
|
|||
} |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save