Upgrades a Kubernetes cluster.
The playbook upgrade/main.yml
and the associated tasks (upgrade/*.yml
)
upgrades a Kubernetes cluster to a chosen version.
The process is not fully automated as some checks should really be performed by a Kubernetes administrator.
This playbook has been tested for the following versions:
1.17
to1.18
1.18
to1.19
1.19
to1.20
This playbook may be called three consecuive times with different tags but with
the same k8s_next_version
variable.
This step initializes the upgrade on the primary master node. This primary node is chosen among the cluster master nodes (first master node in inventory to respond).
Example:
ansible-playbook -i <inventory> playbooks/upgrade/main.yml -e k8s_next_version='1.20' --tags 'primary'
The playbook will give you instructions to finishes the initialization on the primary master node; It should instructs you to:
- Run
kubeadm upgrade plan
to validate that the upgrade process can be done - Run
kubeadm upgrade apply <version>
to upgrade the manifests on the node
This step upgrades all the master nodes one by one.
Example:
ansible-playbook -i <inventory> playbooks/upgrade/main.yml -e k8s_next_version='1.20' --tags 'masters'
This step upgrades all the workers nodes one by one.
Example:
ansible-playbook -i <inventory> playbooks/upgrade/main.yml -e k8s_next_version='1.20' --tags 'workers'
Tag | Description |
---|---|
None | Run pre-flight checks |
primary |
Initializes the upgrade on the primary master node |
masters |
Upgrade all master nodes |
workers |
Upgrade all worker nodes |
Variable | Type | Required | Default | Description |
---|---|---|---|---|
k8s_next_version |
string |
Yes | Kubernetes version to upgrade to in major.minor (e.g. 1.20 ) |