controlPlaneEndpoint set up through load balancer should be possible … (#3888)

* controlPlaneEndpoint set up through load balancer should be possible  even in single master setups

Enable load balancer for single-master setups
Fixes an issue where single-master setups are not reachable using the usual admin.conf from outside the cluster. 

controlPlaneEndpoint set up through load balancer should be possible  even in single master setups

* add fix to other api versions

* remove obsolete check completely

* remove check, pass 2

* removes checks in client configuration

* delete 'and'
This commit is contained in:
Zefool 2018-12-25 09:03:32 +01:00 committed by Kubernetes Prow Robot
parent cd42e649a7
commit 6ebcaab2bb
8 changed files with 8 additions and 8 deletions

View file

@ -3,7 +3,7 @@ kind: NodeConfiguration
caCertPath: {{ kube_cert_dir }}/ca.crt caCertPath: {{ kube_cert_dir }}/ca.crt
token: {{ kubeadm_token }} token: {{ kubeadm_token }}
discoveryTokenAPIServers: discoveryTokenAPIServers:
{% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} {% if kubeadm_config_api_fqdn is defined %}
- {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} - {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %} {% else %}
- {{ kubeadm_discovery_address | replace("https://", "")}} - {{ kubeadm_discovery_address | replace("https://", "")}}

View file

@ -8,7 +8,7 @@ discoveryToken: {{ kubeadm_token }}
tlsBootstrapToken: {{ kubeadm_token }} tlsBootstrapToken: {{ kubeadm_token }}
token: {{ kubeadm_token }} token: {{ kubeadm_token }}
discoveryTokenAPIServers: discoveryTokenAPIServers:
{% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} {% if kubeadm_config_api_fqdn is defined %}
- {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} - {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %} {% else %}
- {{ kubeadm_discovery_address | replace("https://", "")}} - {{ kubeadm_discovery_address | replace("https://", "")}}

View file

@ -8,7 +8,7 @@ discoveryToken: {{ kubeadm_token }}
tlsBootstrapToken: {{ kubeadm_token }} tlsBootstrapToken: {{ kubeadm_token }}
token: {{ kubeadm_token }} token: {{ kubeadm_token }}
discoveryTokenAPIServers: discoveryTokenAPIServers:
{% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} {% if kubeadm_config_api_fqdn is defined %}
- {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} - {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %} {% else %}
- {{ kubeadm_discovery_address | replace("https://", "")}} - {{ kubeadm_discovery_address | replace("https://", "")}}

View file

@ -2,7 +2,7 @@ apiVersion: kubeadm.k8s.io/v1beta1
kind: JoinConfiguration kind: JoinConfiguration
discovery: discovery:
bootstrapToken: bootstrapToken:
{% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} {% if kubeadm_config_api_fqdn is defined %}
apiServerEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} apiServerEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %} {% else %}
apiServerEndpoint: {{ kubeadm_discovery_address | replace("https://", "")}} apiServerEndpoint: {{ kubeadm_discovery_address | replace("https://", "")}}

View file

@ -1,7 +1,7 @@
apiVersion: kubeadm.k8s.io/v1alpha1 apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration kind: MasterConfiguration
api: api:
{% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} {% if kubeadm_config_api_fqdn is defined %}
controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }} controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}
bindPort: {{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} bindPort: {{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %} {% else %}

View file

@ -1,7 +1,7 @@
apiVersion: kubeadm.k8s.io/v1alpha2 apiVersion: kubeadm.k8s.io/v1alpha2
kind: MasterConfiguration kind: MasterConfiguration
api: api:
{% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} {% if kubeadm_config_api_fqdn is defined %}
controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }} controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}
bindPort: {{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} bindPort: {{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %} {% else %}

View file

@ -37,7 +37,7 @@ networking:
serviceSubnet: {{ kube_service_addresses }} serviceSubnet: {{ kube_service_addresses }}
podSubnet: {{ kube_pods_subnet }} podSubnet: {{ kube_pods_subnet }}
kubernetesVersion: {{ kube_version }} kubernetesVersion: {{ kube_version }}
{% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} {% if kubeadm_config_api_fqdn is defined %}
controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %} {% else %}
controlPlaneEndpoint: {{ ip | default(ansible_default_ipv4.address) }}:{{ kube_apiserver_port }} controlPlaneEndpoint: {{ ip | default(ansible_default_ipv4.address) }}:{{ kube_apiserver_port }}

View file

@ -38,7 +38,7 @@ networking:
serviceSubnet: {{ kube_service_addresses }} serviceSubnet: {{ kube_service_addresses }}
podSubnet: {{ kube_pods_subnet }} podSubnet: {{ kube_pods_subnet }}
kubernetesVersion: {{ kube_version }} kubernetesVersion: {{ kube_version }}
{% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} {% if kubeadm_config_api_fqdn is defined %}
controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %} {% else %}
controlPlaneEndpoint: {{ ip | default(ansible_default_ipv4.address) }}:{{ kube_apiserver_port }} controlPlaneEndpoint: {{ ip | default(ansible_default_ipv4.address) }}:{{ kube_apiserver_port }}