Refactored kubeadm join process and fixed uncrodonng for master nodes
This commit is contained in:
parent
b472c2df98
commit
4e61fb9cd3
5 changed files with 3 additions and 11 deletions
|
@ -28,16 +28,14 @@
|
||||||
register: temp_token
|
register: temp_token
|
||||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||||
|
|
||||||
- name: Override predefined kubeadm_token that expires after 24h
|
|
||||||
set_fact:
|
|
||||||
kubeadm_token: "{{ temp_token.stdout }}"
|
|
||||||
|
|
||||||
- name: Create kubeadm client config
|
- name: Create kubeadm client config
|
||||||
template:
|
template:
|
||||||
src: kubeadm-client.conf.j2
|
src: kubeadm-client.conf.j2
|
||||||
dest: "{{ kube_config_dir }}/kubeadm-client.conf"
|
dest: "{{ kube_config_dir }}/kubeadm-client.conf"
|
||||||
backup: yes
|
backup: yes
|
||||||
when: not is_kube_master
|
when: not is_kube_master
|
||||||
|
vars:
|
||||||
|
kubeadm_token: "{{ temp_token.stdout }}"
|
||||||
register: kubeadm_client_conf
|
register: kubeadm_client_conf
|
||||||
|
|
||||||
- name: Join to cluster if needed
|
- name: Join to cluster if needed
|
||||||
|
|
|
@ -82,9 +82,6 @@ controller_mgr_custom_flags: []
|
||||||
|
|
||||||
scheduler_custom_flags: []
|
scheduler_custom_flags: []
|
||||||
|
|
||||||
# kubeadm settings
|
|
||||||
## Value of 0 means it never expires
|
|
||||||
kubeadm_token_ttl: 0
|
|
||||||
## Extra args for k8s components passing by kubeadm
|
## Extra args for k8s components passing by kubeadm
|
||||||
kube_kubeadm_controller_extra_args: {}
|
kube_kubeadm_controller_extra_args: {}
|
||||||
kube_kubeadm_scheduler_extra_args: {}
|
kube_kubeadm_scheduler_extra_args: {}
|
||||||
|
|
|
@ -29,8 +29,6 @@ authorizationModes:
|
||||||
{% for mode in authorization_modes %}
|
{% for mode in authorization_modes %}
|
||||||
- {{ mode }}
|
- {{ mode }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
token: {{ kubeadm_token }}
|
|
||||||
tokenTTL: "{{ kubeadm_token_ttl }}"
|
|
||||||
selfHosted: false
|
selfHosted: false
|
||||||
apiServerExtraArgs:
|
apiServerExtraArgs:
|
||||||
bind-address: {{ kube_apiserver_bind_address }}
|
bind-address: {{ kube_apiserver_bind_address }}
|
||||||
|
|
|
@ -147,7 +147,6 @@ helm_deployment_type: host
|
||||||
|
|
||||||
# Enable kubeadm deployment (experimental)
|
# Enable kubeadm deployment (experimental)
|
||||||
kubeadm_enabled: false
|
kubeadm_enabled: false
|
||||||
kubeadm_token: "abcdef.0123456789abcdef"
|
|
||||||
|
|
||||||
# Make a copy of kubeconfig on the host that runs Ansible in GITDIR/artifacts
|
# Make a copy of kubeconfig on the host that runs Ansible in GITDIR/artifacts
|
||||||
kubeconfig_localhost: false
|
kubeconfig_localhost: false
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
- name: Uncordon node
|
- name: Uncordon node
|
||||||
command: "{{ bin_dir }}/kubectl uncordon {{ inventory_hostname }}"
|
command: "{{ bin_dir }}/kubectl uncordon {{ inventory_hostname }}"
|
||||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||||
when: (needs_cordoning|default(false)) and ( {%- if inventory_hostname in groups['kube-node'] -%} true {%- else -%} false {%- endif -%} )
|
when: needs_cordoning|default(false)
|
||||||
|
|
Loading…
Reference in a new issue