delete master containers forcefully
This commit is contained in:
parent
a3f568fc64
commit
48beef25fa
3 changed files with 15 additions and 11 deletions
|
@ -26,7 +26,7 @@
|
||||||
url: http://localhost:10251/healthz
|
url: http://localhost:10251/healthz
|
||||||
register: scheduler_result
|
register: scheduler_result
|
||||||
until: scheduler_result.status == 200
|
until: scheduler_result.status == 200
|
||||||
retries: 15
|
retries: 60
|
||||||
delay: 5
|
delay: 5
|
||||||
|
|
||||||
- name: Master | wait for kube-controller-manager
|
- name: Master | wait for kube-controller-manager
|
||||||
|
|
|
@ -55,11 +55,10 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
needs_etcd_migration: "{{ kube_apiserver_storage_backend == 'etcd3' and data_migrated.stdout_lines|length == 0 and old_data_exists.rc == 0 }}"
|
needs_etcd_migration: "{{ kube_apiserver_storage_backend == 'etcd3' and data_migrated.stdout_lines|length == 0 and old_data_exists.rc == 0 }}"
|
||||||
|
|
||||||
- name: "Pre-upgrade | Write invalid image to master manifests on all kube-masters"
|
- name: "Pre-upgrade | Delete master manifests on all kube-masters"
|
||||||
replace:
|
file:
|
||||||
dest: "/etc/kubernetes/manifests/{{item[1]}}.manifest"
|
path: "/etc/kubernetes/manifests/{{item[1]}}.manifest"
|
||||||
regexp: '(\s+)image:\s+.*?$'
|
state: absent
|
||||||
replace: '\1image: kill.apiserver.using.fake.image.in:manifest'
|
|
||||||
delegate_to: "{{item[0]}}"
|
delegate_to: "{{item[0]}}"
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{groups['kube-master']}}"
|
- "{{groups['kube-master']}}"
|
||||||
|
@ -67,11 +66,14 @@
|
||||||
register: kube_apiserver_manifest_replaced
|
register: kube_apiserver_manifest_replaced
|
||||||
when: (secret_changed|default(false) or etcd_secret_changed|default(false) or needs_etcd_migration|bool) and kube_apiserver_manifest.stat.exists
|
when: (secret_changed|default(false) or etcd_secret_changed|default(false) or needs_etcd_migration|bool) and kube_apiserver_manifest.stat.exists
|
||||||
|
|
||||||
- name: "Pre-upgrade | Pause while waiting for kubelet to delete kube-apiserver pod"
|
- name: "Pre-upgrade | Delete master containers forcefully on all kube-masters"
|
||||||
pause:
|
shell: "docker ps -f name=k8s-{{item}}* -q | xargs --no-run-if-empty docker rm -f"
|
||||||
seconds: 20
|
delegate_to: "{{item[0]}}"
|
||||||
when: kube_apiserver_manifest_replaced.changed
|
with_nested:
|
||||||
tags: kube-apiserver
|
- "{{groups['kube-master']}}"
|
||||||
|
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
||||||
|
register: kube_apiserver_manifest_replaced
|
||||||
|
when: (secret_changed|default(false) or etcd_secret_changed|default(false) or needs_etcd_migration|bool) and kube_apiserver_manifest.stat.exists
|
||||||
|
|
||||||
- name: "Pre-upgrade | etcd3 upgrade | stop etcd"
|
- name: "Pre-upgrade | etcd3 upgrade | stop etcd"
|
||||||
service:
|
service:
|
||||||
|
|
|
@ -27,10 +27,12 @@
|
||||||
{{node3}}
|
{{node3}}
|
||||||
|
|
||||||
[etcd]
|
[etcd]
|
||||||
|
{{node1}}
|
||||||
{{node2}}
|
{{node2}}
|
||||||
{{node3}}
|
{{node3}}
|
||||||
|
|
||||||
[vault]
|
[vault]
|
||||||
|
{{node1}}
|
||||||
{{node2}}
|
{{node2}}
|
||||||
{{node3}}
|
{{node3}}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Reference in a new issue