diff --git a/roles/kubernetes/kubeadm/tasks/main.yml b/roles/kubernetes/kubeadm/tasks/main.yml index 0616dad5b14..4da21b77d85 100644 --- a/roles/kubernetes/kubeadm/tasks/main.yml +++ b/roles/kubernetes/kubeadm/tasks/main.yml @@ -22,6 +22,16 @@ delegate_to: "{{ groups['kube-master'][0] }}" run_once: true +- name: Create kubeadm token for joining nodes with 24h expiration (default) + command: "{{ bin_dir }}/kubeadm token create" + run_once: true + register: temp_token + 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 template: src: kubeadm-client.conf.j2