c12s-kubespray/roles/kubernetes/node/tasks/pre_upgrade.yml
Chad Swenson e9f795c5ce Master component and kubelet container upgrade fixes
* Fixes an issue where apiserver and friends (controller manager, scheduler) were prevented from restarting after manifests/secrets are changed. This occurred when a replaced kubelet doesn't reconcile new master manifests, which caused old master component versions to linger during deployment. In my case this was causing upgrades from k8s 1.6/1.7 -> k8s 1.8 to fail
* Improves transitions from kubelet container to host kubelet by preventing issues where kubelet container reappeared during the deployment
2017-11-08 01:40:33 -06:00

25 lines
No EOL
859 B
YAML

---
- name: "Pre-upgrade | check if kubelet container exists"
shell: docker ps -af name=kubelet | grep kubelet
failed_when: false
changed_when: false
register: kubelet_container_check
- name: "Pre-upgrade | copy /var/lib/cni from kubelet"
command: docker cp kubelet:/var/lib/cni /var/lib/cni
args:
creates: "/var/lib/cni"
failed_when: false
when: kubelet_container_check.rc == 0
- name: "Pre-upgrade | ensure kubelet container service is stopped if using host deployment"
service:
name: kubelet
state: stopped
when: kubelet_deployment_type == 'host' and kubelet_container_check.rc == 0
- name: "Pre-upgrade | ensure kubelet container is removed if using host deployment"
command: docker rm -fv kubelet
failed_when: false
changed_when: false
when: kubelet_deployment_type == 'host' and kubelet_container_check.rc == 0