Skip to content

Commit

Permalink
Wait for kube-apiserver to come back after pod refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
cristicalin committed Dec 6, 2021
1 parent 1b52d6a commit 19b7e13
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions roles/kubernetes/preinstall/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Preinstall | restart kube-controller-manager crio/containerd
- Preinstall | restart kube-apiserver docker
- Preinstall | restart kube-apiserver crio/containerd
- Preinstall | wait for the apiserver to be running
when: not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] and not is_fedora_coreos

- name: Preinstall | update resolvconf for Flatcar Container Linux by Kinvolk
Expand Down Expand Up @@ -101,6 +102,21 @@
- dns_mode != 'none'
- resolvconf_mode == 'host_resolvconf'

# When running this as the last phase ensure we wait for kube-apiserver to come up
- name: Preinstall | wait for the apiserver to be running
uri:
url: "{{ kube_apiserver_endpoint }}/healthz"
validate_certs: no
register: result
until: result.status == 200
retries: 60
delay: 1
when:
- dns_late
- inventory_hostname in groups['kube_control_plane']
- dns_mode != 'none'
- resolvconf_mode == 'host_resolvconf'

- name: Preinstall | Restart systemd-resolved
service:
name: systemd-resolved
Expand Down

0 comments on commit 19b7e13

Please sign in to comment.