Fix run kubectl error (#2199)
* Fix run kubectl error Fix run kubectl error when first master doesn't work * if access_ip is define use first_kube_master else different master use a different ip * Delete set first_kube_master and use kube_apiserver_access_addresspull/2383/merge
parent
b7e06085c7
commit
128d3ef94c
|
@ -1,15 +1,11 @@
|
||||||
---
|
---
|
||||||
- name: Set first kube master
|
|
||||||
set_fact:
|
|
||||||
first_kube_master: "{{ hostvars[groups['kube-master'][0]]['access_ip'] | default(hostvars[groups['kube-master'][0]]['ip'] | default(hostvars[groups['kube-master'][0]]['ansible_default_ipv4']['address'])) }}"
|
|
||||||
|
|
||||||
- name: Set external kube-apiserver endpoint
|
- name: Set external kube-apiserver endpoint
|
||||||
set_fact:
|
set_fact:
|
||||||
external_apiserver_endpoint: >-
|
external_apiserver_endpoint: >-
|
||||||
{%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%}
|
{%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%}
|
||||||
https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }}
|
https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
https://{{ first_kube_master }}:{{ kube_apiserver_port }}
|
https://{{ kube_apiserver_address }}:{{ kube_apiserver_port }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
tags:
|
tags:
|
||||||
- facts
|
- facts
|
||||||
|
|
Loading…
Reference in New Issue