2015-10-03 20:19:50 +00:00
|
|
|
---
|
2016-08-01 13:12:23 +00:00
|
|
|
- name: Master | restart kubelet
|
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2016-08-25 09:16:14 +00:00
|
|
|
- Master | reload systemd
|
|
|
|
- Master | reload kubelet
|
2016-09-27 09:54:12 +00:00
|
|
|
- Master | wait for master static pods
|
2016-08-01 13:12:23 +00:00
|
|
|
|
2016-09-27 09:54:12 +00:00
|
|
|
- name: Master | wait for master static pods
|
2016-08-01 13:12:23 +00:00
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2016-09-27 09:54:12 +00:00
|
|
|
- Master | wait for the apiserver to be running
|
|
|
|
- Master | wait for kube-scheduler
|
|
|
|
- Master | wait for kube-controller-manager
|
2016-08-01 13:12:23 +00:00
|
|
|
|
2017-11-08 07:40:33 +00:00
|
|
|
- name: Master | Restart apiserver
|
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2019-10-17 01:58:39 +00:00
|
|
|
- Master | Remove apiserver container docker
|
|
|
|
- Master | Remove apiserver container containerd/crio
|
2017-11-08 07:40:33 +00:00
|
|
|
- Master | wait for the apiserver to be running
|
|
|
|
|
|
|
|
- name: Master | Restart kube-scheduler
|
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2019-10-17 01:58:39 +00:00
|
|
|
- Master | Remove scheduler container docker
|
|
|
|
- Master | Remove scheduler container containerd/crio
|
2017-11-08 07:40:33 +00:00
|
|
|
- Master | wait for kube-scheduler
|
|
|
|
|
|
|
|
- name: Master | Restart kube-controller-manager
|
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2019-10-17 01:58:39 +00:00
|
|
|
- Master | Remove controller manager container docker
|
|
|
|
- Master | Remove controller manager container containerd/crio
|
2017-11-08 07:40:33 +00:00
|
|
|
- Master | wait for kube-controller-manager
|
|
|
|
|
2016-08-01 13:12:23 +00:00
|
|
|
- name: Master | reload systemd
|
2019-04-24 05:18:00 +00:00
|
|
|
systemd:
|
|
|
|
daemon_reload: true
|
2016-08-01 13:12:23 +00:00
|
|
|
|
|
|
|
- name: Master | reload kubelet
|
|
|
|
service:
|
|
|
|
name: kubelet
|
|
|
|
state: restarted
|
|
|
|
|
2019-10-17 01:58:39 +00:00
|
|
|
- name: Master | Remove apiserver container docker
|
|
|
|
shell: docker ps -af name=k8s_kube-apiserver* -q | xargs --no-run-if-empty docker rm -f
|
2017-12-12 18:06:41 +00:00
|
|
|
register: remove_apiserver_container
|
2019-04-24 07:08:05 +00:00
|
|
|
retries: 10
|
2017-12-12 18:06:41 +00:00
|
|
|
until: remove_apiserver_container.rc == 0
|
2019-04-24 07:08:05 +00:00
|
|
|
delay: 1
|
2019-10-17 01:58:39 +00:00
|
|
|
when: container_manager == "docker"
|
2017-11-08 07:40:33 +00:00
|
|
|
|
2019-10-17 01:58:39 +00:00
|
|
|
- name: Master | Remove apiserver container containerd/crio
|
2020-11-28 16:30:47 +00:00
|
|
|
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 %'"
|
2019-10-17 01:58:39 +00:00
|
|
|
register: remove_apiserver_container
|
|
|
|
retries: 10
|
|
|
|
until: remove_apiserver_container.rc == 0
|
|
|
|
delay: 1
|
|
|
|
when: container_manager in ['containerd', 'crio']
|
|
|
|
|
|
|
|
- name: Master | Remove scheduler container docker
|
2020-11-28 16:30:47 +00:00
|
|
|
shell: "{{ docker_bin_dir }}/docker ps -af name=k8s_kube-scheduler* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
|
2017-12-12 18:06:41 +00:00
|
|
|
register: remove_scheduler_container
|
2019-04-24 07:08:05 +00:00
|
|
|
retries: 10
|
2017-12-12 18:06:41 +00:00
|
|
|
until: remove_scheduler_container.rc == 0
|
2019-04-24 07:08:05 +00:00
|
|
|
delay: 1
|
2019-10-17 01:58:39 +00:00
|
|
|
when: container_manager == "docker"
|
2017-11-08 07:40:33 +00:00
|
|
|
|
2019-10-17 01:58:39 +00:00
|
|
|
- name: Master | Remove scheduler container containerd/crio
|
2020-11-28 16:30:47 +00:00
|
|
|
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 %'"
|
2019-10-17 01:58:39 +00:00
|
|
|
register: remove_scheduler_container
|
|
|
|
retries: 10
|
|
|
|
until: remove_scheduler_container.rc == 0
|
|
|
|
delay: 1
|
|
|
|
when: container_manager in ['containerd', 'crio']
|
|
|
|
|
|
|
|
- name: Master | Remove controller manager container docker
|
2020-11-28 16:30:47 +00:00
|
|
|
shell: "{{ docker_bin_dir }}/docker ps -af name=k8s_kube-controller-manager* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
|
2017-12-12 18:06:41 +00:00
|
|
|
register: remove_cm_container
|
2019-04-24 07:08:05 +00:00
|
|
|
retries: 10
|
2017-12-12 18:06:41 +00:00
|
|
|
until: remove_cm_container.rc == 0
|
2019-04-24 07:08:05 +00:00
|
|
|
delay: 1
|
2019-10-17 01:58:39 +00:00
|
|
|
when: container_manager == "docker"
|
|
|
|
|
|
|
|
- name: Master | Remove controller manager container containerd/crio
|
2020-11-28 16:30:47 +00:00
|
|
|
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 %'"
|
2019-10-17 01:58:39 +00:00
|
|
|
register: remove_cm_container
|
|
|
|
retries: 10
|
|
|
|
until: remove_cm_container.rc == 0
|
|
|
|
delay: 1
|
|
|
|
when: container_manager in ['containerd', 'crio']
|
2017-11-08 07:40:33 +00:00
|
|
|
|
2016-09-27 09:54:12 +00:00
|
|
|
- name: Master | wait for kube-scheduler
|
2017-02-17 21:22:34 +00:00
|
|
|
uri:
|
2020-07-27 07:26:17 +00:00
|
|
|
url: https://localhost:10259/healthz
|
|
|
|
validate_certs: no
|
2016-08-01 13:12:23 +00:00
|
|
|
register: scheduler_result
|
|
|
|
until: scheduler_result.status == 200
|
2017-03-27 11:44:21 +00:00
|
|
|
retries: 60
|
2019-04-24 07:08:05 +00:00
|
|
|
delay: 1
|
2016-08-01 13:12:23 +00:00
|
|
|
|
2016-09-27 09:54:12 +00:00
|
|
|
- name: Master | wait for kube-controller-manager
|
2017-02-17 21:22:34 +00:00
|
|
|
uri:
|
2020-07-27 07:26:17 +00:00
|
|
|
url: https://localhost:10257/healthz
|
|
|
|
validate_certs: no
|
2016-08-01 13:12:23 +00:00
|
|
|
register: controller_manager_result
|
|
|
|
until: controller_manager_result.status == 200
|
2019-04-24 07:08:05 +00:00
|
|
|
retries: 60
|
|
|
|
delay: 1
|
2016-09-27 09:54:12 +00:00
|
|
|
|
|
|
|
- name: Master | wait for the apiserver to be running
|
2017-02-17 21:22:34 +00:00
|
|
|
uri:
|
2017-11-06 20:01:10 +00:00
|
|
|
url: "{{ kube_apiserver_endpoint }}/healthz"
|
|
|
|
validate_certs: no
|
2016-09-27 09:54:12 +00:00
|
|
|
register: result
|
|
|
|
until: result.status == 200
|
2019-04-24 07:08:05 +00:00
|
|
|
retries: 60
|
|
|
|
delay: 1
|
2017-09-13 18:00:51 +00:00
|
|
|
|
|
|
|
- name: Master | set secret_changed
|
2017-10-12 08:55:46 +00:00
|
|
|
command: /bin/true
|
|
|
|
notify:
|
|
|
|
- Master | set secret_changed to true
|
2018-12-06 10:33:38 +00:00
|
|
|
- Master | Copy new kubeconfig for root user
|
2017-10-12 08:55:46 +00:00
|
|
|
|
|
|
|
- name: Master | set secret_changed to true
|
2017-09-13 18:00:51 +00:00
|
|
|
set_fact:
|
|
|
|
secret_changed: true
|
2017-10-12 08:55:46 +00:00
|
|
|
|
2018-12-06 10:33:38 +00:00
|
|
|
- name: Master | Copy new kubeconfig for root user
|
|
|
|
copy:
|
|
|
|
src: "{{ kube_config_dir }}/admin.conf"
|
2019-06-06 09:06:11 +00:00
|
|
|
dest: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
|
2018-12-06 10:33:38 +00:00
|
|
|
remote_src: yes
|
|
|
|
mode: "0600"
|
|
|
|
backup: yes
|