Fix control plane setup without a hardcoded key (#4610)

This commit is contained in:
Matthew Mosesohn
2019-04-24 00:37:59 +03:00
committed by Kubernetes Prow Robot
parent 228b244c84
commit d6d7458d68
4 changed files with 31 additions and 13 deletions

View File

@@ -25,6 +25,24 @@
port: "{{kubeadm_discovery_address.split(':')[1]}}"
timeout: 180
- name: Upload certificates so they are fresh and not expired
command: >-
{{ bin_dir }}/kubeadm init phase
--config {{ kube_config_dir}}/kubeadm-config.yaml
upload-certs --experimental-upload-certs
{% if kubeadm_certificate_key is defined %}
--certificate-key={{ kubeadm_certificate_key }}
{% endif %}
run_once: yes
register: kubeadm_upload_cert
delegate_to: "{{ groups['kube-master'][0] }}"
- name: Parse certificate key if not set
set_fact:
kubeadm_certificate_key: "{{ hostvars[groups['kube-master'][0]]['kubeadm_upload_cert'].stdout_lines[-1] | trim }}"
when: kubeadm_certificate_key is undefined
- name: Joining control plane node to the cluster.
command: >-
{{ bin_dir }}/kubeadm join