Skip to content
Snippets Groups Projects
Unverified Commit d4204a42 authored by Alexander D. Kanevskiy's avatar Alexander D. Kanevskiy Committed by GitHub
Browse files

Fix crictl paths and some of docker paths (#6961)

If crictl (and docker) binaries are deployed to the directories
that are not in standard PATH (e.g. /usr/local/bin), it is required
to specify full path to the binaries.
parent c6f69404
No related branches found
No related tags found
No related merge requests found
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
- block: - block:
- name: Copy etcdctl script to host - name: Copy etcdctl script to host
shell: "docker exec \"$(docker ps -qf ancestor={{ etcd_image_repo }}:{{ etcd_image_tag }})\" cp /usr/local/bin/etcdctl {{ etcd_data_dir }}" shell: "{{ docker_bin_dir }}/docker exec \"$({{ docker_bin_dir }}/docker ps -qf ancestor={{ etcd_image_repo }}:{{ etcd_image_tag }})\" cp /usr/local/bin/etcdctl {{ etcd_data_dir }}"
when: container_manager == "docker" when: container_manager == "docker"
- name: Copy etcdctl script to host - name: Copy etcdctl script to host
shell: "crictl exec \"$(crictl ps -q --image {{ etcd_image_repo }}:{{ etcd_image_tag }})\" cp /usr/local/bin/etcdctl {{ etcd_data_dir }}" shell: "{{ bin_dir }}/crictl exec \"$({{ bin_dir }}/crictl ps -q --image {{ etcd_image_repo }}:{{ etcd_image_tag }})\" cp /usr/local/bin/etcdctl {{ etcd_data_dir }}"
when: container_manager in ['crio', 'containerd'] when: container_manager in ['crio', 'containerd']
- name: Copy etcdctl to {{ bin_dir }} - name: Copy etcdctl to {{ bin_dir }}
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
when: container_manager == "docker" when: container_manager == "docker"
- name: Master | Remove apiserver container containerd/crio - name: Master | Remove apiserver container containerd/crio
shell: crictl pods --name kube-apiserver* -q | xargs -I% --no-run-if-empty bash -c 'crictl stopp % && crictl rmp %' 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: remove_apiserver_container register: remove_apiserver_container
retries: 10 retries: 10
until: remove_apiserver_container.rc == 0 until: remove_apiserver_container.rc == 0
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
when: container_manager in ['containerd', 'crio'] when: container_manager in ['containerd', 'crio']
- name: Master | Remove scheduler container docker - name: Master | Remove scheduler container docker
shell: "docker ps -af name=k8s_kube-scheduler* -q | xargs --no-run-if-empty docker rm -f" shell: "{{ docker_bin_dir }}/docker ps -af name=k8s_kube-scheduler* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
register: remove_scheduler_container register: remove_scheduler_container
retries: 10 retries: 10
until: remove_scheduler_container.rc == 0 until: remove_scheduler_container.rc == 0
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
when: container_manager == "docker" when: container_manager == "docker"
- name: Master | Remove scheduler container containerd/crio - name: Master | Remove scheduler container containerd/crio
shell: crictl pods --name kube-scheduler* -q | xargs -I% --no-run-if-empty bash -c 'crictl stopp % && crictl rmp %' shell: "{{ bin_dir }}/crictl pods --name kube-scheduler* -q | xargs -I% --no-run-if-empty bash -c '{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %'"
register: remove_scheduler_container register: remove_scheduler_container
retries: 10 retries: 10
until: remove_scheduler_container.rc == 0 until: remove_scheduler_container.rc == 0
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
when: container_manager in ['containerd', 'crio'] when: container_manager in ['containerd', 'crio']
- name: Master | Remove controller manager container docker - name: Master | Remove controller manager container docker
shell: "docker ps -af name=k8s_kube-controller-manager* -q | xargs --no-run-if-empty docker rm -f" shell: "{{ docker_bin_dir }}/docker ps -af name=k8s_kube-controller-manager* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
register: remove_cm_container register: remove_cm_container
retries: 10 retries: 10
until: remove_cm_container.rc == 0 until: remove_cm_container.rc == 0
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
when: container_manager == "docker" when: container_manager == "docker"
- name: Master | Remove controller manager container containerd/crio - name: Master | Remove controller manager container containerd/crio
shell: crictl pods --name kube-controller-manager* -q | xargs -I% --no-run-if-empty bash -c 'crictl stopp % && crictl rmp %' 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: remove_cm_container register: remove_cm_container
retries: 10 retries: 10
until: remove_cm_container.rc == 0 until: remove_cm_container.rc == 0
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
shell: >- shell: >-
set -o pipefail && set -o pipefail &&
{% if container_manager in ['crio', 'docker'] %} {% if container_manager in ['crio', 'docker'] %}
docker ps -af name=kubelet | grep kubelet {{ docker_bin_dir }}/docker ps -af name=kubelet | grep kubelet
{% elif container_manager == 'containerd' %} {% elif container_manager == 'containerd' %}
crictl ps --all --name kubelet | grep kubelet {{ bin_dir }}/crictl ps --all --name kubelet | grep kubelet
{% endif %} {% endif %}
args: args:
executable: /bin/bash executable: /bin/bash
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
- name: "Pre-upgrade | ensure kubelet container is removed if using host deployment" - name: "Pre-upgrade | ensure kubelet container is removed if using host deployment"
shell: >- shell: >-
{% if container_manager in ['crio', 'docker'] %} {% if container_manager in ['crio', 'docker'] %}
docker rm -fv kubelet {{ docker_bin_dir }}/docker rm -fv kubelet
{% elif container_manager == 'containerd' %} {% elif container_manager == 'containerd' %}
crictl stop kubelet && crictl rm kubelet {{ bin_dir }}/crictl stop kubelet && {{ bin_dir }}/crictl rm kubelet
{% endif %} {% endif %}
failed_when: false failed_when: false
changed_when: false changed_when: false
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf' when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
- name: Preinstall | restart kube-controller-manager docker - name: Preinstall | restart kube-controller-manager docker
shell: "docker ps -f name=k8s_POD_kube-controller-manager* -q | xargs --no-run-if-empty docker rm -f" shell: "{{ docker_bin_dir }}/docker ps -f name=k8s_POD_kube-controller-manager* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
when: when:
- container_manager == "docker" - container_manager == "docker"
- inventory_hostname in groups['kube-master'] - inventory_hostname in groups['kube-master']
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
- kube_controller_set.stat.exists - kube_controller_set.stat.exists
- name: Preinstall | restart kube-controller-manager crio/containerd - name: Preinstall | restart kube-controller-manager crio/containerd
shell: crictl pods --name kube-controller-manager* -q | xargs -I% --no-run-if-empty bash -c 'crictl stopp % && crictl rmp %' 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 %'"
when: when:
- container_manager in ['crio', 'containerd'] - container_manager in ['crio', 'containerd']
- inventory_hostname in groups['kube-master'] - inventory_hostname in groups['kube-master']
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
- kube_controller_set.stat.exists - kube_controller_set.stat.exists
- name: Preinstall | restart kube-apiserver docker - name: Preinstall | restart kube-apiserver docker
shell: "docker ps -f name=k8s_POD_kube-apiserver* -q | xargs --no-run-if-empty docker rm -f" shell: "{{ docker_bin_dir }}/docker ps -f name=k8s_POD_kube-apiserver* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
when: when:
- container_manager == "docker" - container_manager == "docker"
- inventory_hostname in groups['kube-master'] - inventory_hostname in groups['kube-master']
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
- resolvconf_mode == 'host_resolvconf' - resolvconf_mode == 'host_resolvconf'
- name: Preinstall | restart kube-apiserver crio/containerd - name: Preinstall | restart kube-apiserver crio/containerd
shell: crictl pods --name kube-apiserver* -q | xargs -I% --no-run-if-empty bash -c 'crictl stopp % && crictl rmp %' 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 %'"
when: when:
- container_manager in ['crio', 'containerd'] - container_manager in ['crio', 'containerd']
- inventory_hostname in groups['kube-master'] - inventory_hostname in groups['kube-master']
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
- containerd | delete kube-router containers - containerd | delete kube-router containers
- name: docker | delete kube-router containers - name: docker | delete kube-router containers
shell: "docker ps -af name=k8s_POD_kube-router* -q | xargs --no-run-if-empty docker rm -f" shell: "{{ docker_bin_dir }}/docker ps -af name=k8s_POD_kube-router* -q | xargs --no-run-if-empty docker rm -f"
register: docker_kube_router_remove register: docker_kube_router_remove
until: docker_kube_router_remove is succeeded until: docker_kube_router_remove is succeeded
retries: 5 retries: 5
when: container_manager in ["docker"] when: container_manager in ["docker"]
- name: containerd | delete kube-router containers - name: containerd | delete kube-router containers
shell: 'crictl pods --name kube-router* -q | xargs -I% --no-run-if-empty bash -c "crictl stopp % && crictl rmp %"' shell: '{{ bin_dir }}/crictl pods --name kube-router* -q | xargs -I% --no-run-if-empty bash -c "{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %"'
register: crictl_kube_router_remove register: crictl_kube_router_remove
until: crictl_kube_router_remove is succeeded until: crictl_kube_router_remove is succeeded
retries: 5 retries: 5
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
- docker - docker
- name: reset | stop all cri containers - name: reset | stop all cri containers
shell: "set -o pipefail && crictl ps -aq | xargs -r crictl -t 60s stop" shell: "set -o pipefail && {{ bin_dir }}/crictl ps -aq | xargs -r {{ bin_dir }}/crictl -t 60s stop"
args: args:
executable: /bin/bash executable: /bin/bash
register: remove_all_cri_containers register: remove_all_cri_containers
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
when: container_manager in ["crio", "containerd"] when: container_manager in ["crio", "containerd"]
- name: reset | remove all cri containers - name: reset | remove all cri containers
shell: "set -o pipefail && crictl ps -aq | xargs -r crictl -t 60s rm" shell: "set -o pipefail && {{ bin_dir }}/crictl ps -aq | xargs -r {{ bin_dir }}/crictl -t 60s rm"
args: args:
executable: /bin/bash executable: /bin/bash
register: remove_all_cri_containers register: remove_all_cri_containers
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
when: container_manager == "crio" when: container_manager == "crio"
- name: reset | stop all cri pods - name: reset | stop all cri pods
shell: "set -o pipefail && crictl pods -q | xargs -r crictl -t 60s stopp" shell: "set -o pipefail && {{ bin_dir }}/crictl pods -q | xargs -r {{ bin_dir }}/crictl -t 60s stopp"
args: args:
executable: /bin/bash executable: /bin/bash
register: remove_all_cri_containers register: remove_all_cri_containers
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
when: container_manager == "containerd" when: container_manager == "containerd"
- name: reset | remove all cri pods - name: reset | remove all cri pods
shell: "set -o pipefail && crictl pods -q | xargs -r crictl -t 60s rmp" shell: "set -o pipefail && {{ bin_dir }}/crictl pods -q | xargs -r {{ bin_dir }}/crictl -t 60s rmp"
args: args:
executable: /bin/bash executable: /bin/bash
register: remove_all_cri_containers register: remove_all_cri_containers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment