Fix external lb error (#8299)

This commit is contained in:
singeleaf 2021-12-14 06:46:27 +08:00 committed by GitHub
parent 8ac510e4d6
commit 4f2e4524b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -60,3 +60,10 @@ pkg_install_retries: 4
# Check if access_ip responds to ping. Set false if your firewall blocks ICMP.
ping_access_ip: true
apiserver_loadbalancer_domain_name_host: |-
{% if inventory_hostname in groups['kube_control_plane'] -%}
127.0.0.1
{%- else -%}
{{ loadbalancer_apiserver.address }}
{%- endif %}

View file

@ -29,7 +29,7 @@
lineinfile:
dest: /etc/hosts
regexp: ".*{{ apiserver_loadbalancer_domain_name }}$"
line: "{{ loadbalancer_apiserver.address }} {{ apiserver_loadbalancer_domain_name }}"
line: "{{ apiserver_loadbalancer_domain_name_host }} {{ apiserver_loadbalancer_domain_name }}"
state: present
backup: yes
unsafe_writes: yes