Description
This page will explain how to start an automated upgrade in k3s
Steps
- Install system-upgrader
kubectl apply -f https://github.com/rancher/system-upgrade-controller/releases/latest/download/system-upgrade-controller.yaml- This will install the system-upgrader in the namespace
system-upgrade
- This will install the system-upgrader in the namespace
- Configure Plans
- It is recommended to configure a separate plan for the Server ( master ) and the agent ( worker ) nodes. Check out Plans for more info.
- When deciding what version to use, check out K3S Releases
Plans
Important options:
concurencyindicates how many nodes at a time can be upgraded. A good value here is one.prepareas indicated in the Agent Plan will force the Server Plan to go first, before upgrading the agents.versionshould be the same for the agent and the server. This is the Kubernetes version that we will be upgrading to. Check out K3S Releases
Server Plan
# Server plan
apiVersion: upgrade.cattle.io/v1
kind: Plan
metadata:
name: server-plan
namespace: system-upgrade
spec:
concurrency: 1
cordon: true
nodeSelector:
matchExpressions:
- key: node-role.kubernetes.io/master
operator: In
values:
- "true"
serviceAccountName: system-upgrade
upgrade:
image: rancher/k3s-upgrade
version: v1.23.4+k3s1Agent Plan
# Agent plan
apiVersion: upgrade.cattle.io/v1
kind: Plan
metadata:
name: agent-plan
namespace: system-upgrade
spec:
concurrency: 1
cordon: true
nodeSelector:
matchExpressions:
- key: node-role.kubernetes.io/master
operator: DoesNotExist
prepare:
args:
- prepare
- server-plan
image: rancher/k3s-upgrade
serviceAccountName: system-upgrade
upgrade:
image: rancher/k3s-upgrade
version: v1.23.4+k3s1Troubleshooting
Upgrade for node is stuck
This happens when the workloads for that specific node cannot be terminated on time.
~ Solution ~
Restart and uncordon the node.
Links: HomeLab Example