From cdb82a84101d4a802378570faaa76ccf72578de3 Mon Sep 17 00:00:00 2001 From: "hang.jiang" Date: Sun, 23 Apr 2023 16:41:23 +0800 Subject: [PATCH] Add Retry for restart kube-controller-manager Signed-off-by: hang.jiang --- 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 631ea743e9c..0212530f4f1 100644 --- a/roles/kubernetes/preinstall/handlers/main.yml +++ b/roles/kubernetes/preinstall/handlers/main.yml @@ -78,6 +78,10 @@ - name: Preinstall | restart kube-controller-manager crio/containerd shell: "{{ bin_dir }}/crictl pods --name kube-controller-manager* -q | xargs -I% --no-run-if-empty bash -c '{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %'" + register: preinstall_restart_controller_manager + retries: 10 + delay: 1 + until: preinstall_restart_controller_manager.rc == 0 when: - container_manager in ['crio', 'containerd'] - inventory_hostname in groups['kube_control_plane']