From 11d9c2e2c3db8ee4fa6ad1997c0824eecd1ad6b6 Mon Sep 17 00:00:00 2001 From: Bobonium Date: Mon, 7 Jan 2019 23:06:52 +0100 Subject: [PATCH] use api server loadbalancer ip if external loadbalancer is used - this fixes the broken kube-router deployment --- roles/kubespray-defaults/defaults/main.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index c5e8f55f6..62d248137 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -387,16 +387,14 @@ loadbalancer_apiserver_localhost: "{{ loadbalancer_apiserver is not defined }}" # applied if only external loadbalancer_apiserver is defined, otherwise ignored apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local" kube_apiserver_endpoint: |- - {% if not is_kube_master and loadbalancer_apiserver_localhost -%} + {% if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%} + https://{{ apiserver_loadbalancer_domain_name|default('lb-apiserver.kubernetes.local') }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }} + {%- elif not is_kube_master and loadbalancer_apiserver_localhost -%} https://localhost:{{ nginx_kube_apiserver_port|default(kube_apiserver_port) }} {%- elif is_kube_master -%} https://{{ kube_apiserver_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_port }} {%- else -%} - {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%} - https://{{ apiserver_loadbalancer_domain_name|default('lb-apiserver.kubernetes.local') }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }} - {%- else -%} https://{{ first_kube_master }}:{{ kube_apiserver_port }} - {%- endif -%} {%- endif %} kube_apiserver_insecure_endpoint: >- http://{{ kube_apiserver_insecure_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_insecure_port }}