delete master containers forcefully

This commit is contained in:
Matthew Mosesohn 2017-03-27 14:44:21 +03:00
parent a3f568fc64
commit 48beef25fa
3 changed files with 15 additions and 11 deletions

View file

@ -26,7 +26,7 @@
url: http://localhost:10251/healthz
register: scheduler_result
until: scheduler_result.status == 200
retries: 15
retries: 60
delay: 5
- name: Master | wait for kube-controller-manager

View file

@ -55,11 +55,10 @@
set_fact:
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"
replace:
dest: "/etc/kubernetes/manifests/{{item[1]}}.manifest"
regexp: '(\s+)image:\s+.*?$'
replace: '\1image: kill.apiserver.using.fake.image.in:manifest'
- name: "Pre-upgrade | Delete master manifests on all kube-masters"
file:
path: "/etc/kubernetes/manifests/{{item[1]}}.manifest"
state: absent
delegate_to: "{{item[0]}}"
with_nested:
- "{{groups['kube-master']}}"
@ -67,11 +66,14 @@
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 | Pause while waiting for kubelet to delete kube-apiserver pod"
pause:
seconds: 20
when: kube_apiserver_manifest_replaced.changed
tags: kube-apiserver
- name: "Pre-upgrade | Delete master containers forcefully on all kube-masters"
shell: "docker ps -f name=k8s-{{item}}* -q | xargs --no-run-if-empty docker rm -f"
delegate_to: "{{item[0]}}"
with_nested:
- "{{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"
service:

View file

@ -27,10 +27,12 @@
{{node3}}
[etcd]
{{node1}}
{{node2}}
{{node3}}
[vault]
{{node1}}
{{node2}}
{{node3}}
{% else %}