From 6386ec029c72870c985ed31f8d9180c5229b3890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20M=C5=82ynek?= <75165213+krystianmlynek@users.noreply.github.com> Date: Thu, 8 Sep 2022 01:48:49 +0200 Subject: [PATCH] add retries for restart of kube-apiserver (#9256) * add retries for restart of kube-apiserver * change var name --- roles/kubernetes/preinstall/handlers/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/kubernetes/preinstall/handlers/main.yml b/roles/kubernetes/preinstall/handlers/main.yml index 70c6414c9..4c24b83a2 100644 --- a/roles/kubernetes/preinstall/handlers/main.yml +++ b/roles/kubernetes/preinstall/handlers/main.yml @@ -95,6 +95,10 @@ - name: Preinstall | restart kube-apiserver crio/containerd shell: "{{ bin_dir }}/crictl pods --name kube-apiserver* -q | xargs -I% --no-run-if-empty bash -c '{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %'" + register: preinstall_restart_apiserver + retries: 10 + until: preinstall_restart_apiserver.rc == 0 + delay: 1 when: - container_manager in ['crio', 'containerd'] - inventory_hostname in groups['kube_control_plane']