Skip to content

Commit

Permalink
overcame the kubeadm join race condition issue with serial: 1 role
Browse files Browse the repository at this point in the history
  • Loading branch information
mwalzer committed Aug 28, 2017
1 parent b07b32c commit c7f8892
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
15 changes: 14 additions & 1 deletion roles/common/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
- name: show ssh_host
debug:
msg: "{{ ansible_ssh_host }}"

- name: show host
debug:
msg: "{{ ansible_host }}"

#waiting for ssh is done in the openstack roles anyway ...
# first timeout to wait for ssh to come available...
# wait 300 seconds for port 22 to become open and contain "OpenSSH", don't assume the inventory_hostname is resolvable
# and don't start checking for 10 seconds
- local_action: wait_for port=22 host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex=OpenSSH delay=10
#- name: Wait for ssh to become available
# local_action:
# wait_for port="22" host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex="OpenSSH" delay=10
# delegate_to: "{{ groups.master[0] }}"
# when: state == "present"

#seems this is what ansible is instructed to do before instance is deemed ready (some gzip going on, taking quite some time...)
- name: Wait for cloud-init to finish
Expand Down
4 changes: 2 additions & 2 deletions roles/kubeadm-master/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@
become_user: centos

#obsolete with kubernetes 1.7.1 https://github.com/kubevirt/kubevirt/pull/292
#- name: Workaround kubeadm 1.7.0 race condition, see https://github.com/kubernetes/kubeadm/issues/335
# script: kubeadm-1-7-0-race-condition-workaround.sh
- name: Workaround kubeadm 1.7.0 race condition, see https://github.com/kubernetes/kubeadm/issues/335
script: kubeadm-1-7-0-race-condition-workaround.sh
11 changes: 8 additions & 3 deletions roles/kubeadm-nodes/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
- name: Install a pod network
command: sh -c 'printenv'

- name: show host
debug:
msg: "{{ ansible_host }}"

- name: show token
debug:
msg: "{{ hostvars[groups.master[0]]['token'].stdout }}"

- name: kubeadm join
command: "kubeadm join --skip-preflight-checks --token {{ hostvars[groups.master[0]]['token'].stdout }} {{ hostvars[groups.master[0]]['ansible_default_ipv4']['address'] }}:6443"
args:
Expand Down
5 changes: 3 additions & 2 deletions site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
- bootstrap
gather_facts: false
roles:
# - common
- common

- name: Install repo and packages
hosts: all
Expand All @@ -61,9 +61,10 @@

- name: k8s nodes setup
hosts: nodes
become: true
serial: 1
tags:
- bootstrap
become: true
roles:
- kubeadm-nodes

Expand Down

0 comments on commit c7f8892

Please sign in to comment.