forked from chris-short/rak8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade.yml
56 lines (50 loc) · 1.23 KB
/
upgrade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- hosts: master
tasks:
- name: Upgrade kubeadm
apt:
name: ['kubeadm']
state: latest
force: yes
update_cache: yes
autoclean: yes
autoremove: yes
- name: Determine latest stable version of Kubernetes
shell: curl -sSL https://dl.k8s.io/release/stable.txt
register: stable_ver
args:
warn: False
- name: Upgrade cluster with kubeadm
shell: "kubeadm upgrade apply -y {{ stable_ver.stdout }}"
async: 600
poll: 5
- name: Cordon Hosts
shell: "kubectl cordon {{ item }}"
with_items:
- "{{ groups['all'] }}"
tags: cordon
- name: Drain Hosts
shell: "kubectl drain {{ item }} --ignore-daemonsets"
with_items:
- "{{ groups['all'] }}"
ignore_errors: yes
tags: drain
- hosts: all
tasks:
- name: Upgrade Y'all
apt:
name: ['kubelet', 'kubectl']
state: latest
force: yes
update_cache: yes
autoclean: yes
autoremove: yes
tags:
- kubelet
- kubectl
- hosts: master
tasks:
- name: Uncordon Hosts
shell: "kubectl uncordon {{ item }}"
with_items:
- "{{ groups['all'] }}"
tags: uncordon