forked from chris-short/rak8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade.yml
45 lines (40 loc) · 1.48 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
- hosts: all
vars:
kube_version: 1.20.2
tasks:
- name: apt-get update
apt:
update_cache: yes
autoclean: yes
autoremove: yes
- name: Upgrade Kubernetes (kubelet, kubeadm, kubectl)
apt:
pkg:
- kubeadm={{ kube_version }}-00
- kubelet={{ kube_version }}-00
- kubectl={{ kube_version }}-00
dpkg_options: force-downgrade
force: yes
- name: Upgrade one node
command: "kubeadm upgrade apply v{{ kube_version }} --ignore-preflight-errors=ControlPlaneNodesReady --yes"
# For the other control plane nodes
# Same as the first control plane node but use:
# kubeadm upgrade node
# instead of:
# kubeadm upgrade apply
# https://v1-16.docs.kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/
when: inventory_hostname == play_hosts[0]
- name: Reinstall Flannel (For Kubernetes v1.17+)
# https://stackoverflow.com/questions/49112336/container-runtime-network-not-ready-cni-config-uninitialized
command: kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
when: inventory_hostname == play_hosts[0]
- name: Upgrade other nodes
command: "kubeadm upgrade node"
when: inventory_hostname != play_hosts[0]
- hosts: master
tasks:
- name: Uncordon Hosts
shell: "kubectl uncordon {{ item }}"
with_items:
- "{{ groups['all'] }}"
tags: uncordon