From 796d3fb975cd880c42f6dcf67001588fa20510e6 Mon Sep 17 00:00:00 2001 From: stress-t Date: Tue, 16 Feb 2021 16:19:05 +0300 Subject: [PATCH] Improving PR 6473 (#7259) --- inventory/sample/group_vars/all/all.yml | 5 +++++ roles/kubespray-defaults/defaults/main.yaml | 2 ++ 2 files changed, 7 insertions(+) diff --git a/inventory/sample/group_vars/all/all.yml b/inventory/sample/group_vars/all/all.yml index 89b396793..d0e2f391b 100644 --- a/inventory/sample/group_vars/all/all.yml +++ b/inventory/sample/group_vars/all/all.yml @@ -27,6 +27,11 @@ bin_dir: /usr/local/bin # valid options are "nginx" or "haproxy" # loadbalancer_apiserver_type: nginx # valid values "nginx" or "haproxy" +## If the cilium is going to be used in strict mode, we can use the +## localhost connection and not use the external LB. If this parameter is +## not specified, the first node to connect to kubeapi will be used. +# use_localhost_as_kubeapi_loadbalancer: true + ## Local loadbalancer should use this port ## And must be set port 6443 loadbalancer_apiserver_port: 6443 diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index 0da603073..cd8a47d6c 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -464,6 +464,8 @@ apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local" kube_apiserver_global_endpoint: |- {% if loadbalancer_apiserver is defined -%} https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }} + {%- elif use_localhost_as_kubeapi_loadbalancer is defined -%} + https://127.0.0.1:{{ kube_apiserver_port }} {%- else -%} https://{{ first_kube_master }}:{{ kube_apiserver_port }} {%- endif %}