Improve kubeadm join tasks (#4206)

Fix issue where `kubeadm join` could wait forever for joining.

Fix issue where `kubeadm join` were not reaching the user, making
impossible to find the cause of the failure.

New behaviour is to first attempt to join without bypassing the
verifications checks and to display them if needed.

If this fails it still attempts to join by ignoring the check in
order to make previous behavior.

A timeout of 60 seconds is allocated for a joining.

Related-bug: #3973
This commit is contained in:
Sorin Sbarnea 2019-02-12 21:42:56 +00:00 committed by Kubernetes Prow Robot
parent 8b289ad9e1
commit 22a5a00c49

View file

@ -65,14 +65,38 @@
kubeadm_token: "{{ temp_token.stdout }}" kubeadm_token: "{{ temp_token.stdout }}"
- name: Join to cluster if needed - name: Join to cluster if needed
environment:
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}"
when: not is_kube_master and (not kubelet_conf.stat.exists)
block:
- name: Join to cluster
command: >-
{{ bin_dir }}/kubeadm join
--config {{ kube_config_dir}}/kubeadm-client.conf
register: kubeadm_join
async: 60
poll: 15
rescue:
- name: Join to cluster with ignores
command: >- command: >-
{{ bin_dir }}/kubeadm join {{ bin_dir }}/kubeadm join
--config {{ kube_config_dir}}/kubeadm-client.conf --config {{ kube_config_dir}}/kubeadm-client.conf
--ignore-preflight-errors=all --ignore-preflight-errors=all
register: kubeadm_join register: kubeadm_join
when: not is_kube_master and (not kubelet_conf.stat.exists) async: 60
environment: poll: 15
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}"
always:
- name: Display kubeadm join stderr if any
when: kubeadm_join is failed
debug:
message: |
Joined with warnings
{{ kubeadm_join.stderr_lines }}
- name: Wait for kubelet bootstrap to create config - name: Wait for kubelet bootstrap to create config
wait_for: wait_for: