K3s - Upgrade

Prerequisites

  1. Access to all nodes of the cluster through one of the following methods:

    - Rancher

    - SSH protocol

    - AWS Session Manager

  2. The K3s version tag you wish to upgrade to: https://github.com/k3s-io/k3s/releases.
  3. The system-upgrade-controller file that will be used to upgrade the K3s cluster: https://assets.master.k3s.getvisibility.com/system-upgrade-controller/v0.10.0/system-upgrade-controller.yaml
  4. The Bundle file for the K3s upgrade in the Air-Gap Environment.
  5. Make sure you push all new docker images to the ECR gv-public docker registry that you need to install the new k3s version.

FDC services

Updates and custom settings are automatically applied to all backend services using Fleet as long as the cluster has access to the public internet and can connect to the management server.

In case there is no internet connection, or the management server is down, the cluster agent will keep trying to reach the management server until a connection can be established.

Upgrading K3s to 1.24

  1. Log in to Rancher or one of the master nodes of the cluster to use kubectl CLI.
  2. List the node name and the K3s version:
    kubectl get nodes
  3. Add the label k3s-upgrade=true to the nodes: Note: In the case of a multi-node cluster, each node will be updated with the label mentioned above.
    kubectl label node --all k3s-upgrade=true
  4. Deploy the system-upgrade-controller:
    kubectl apply -f https://assets.master.k3s.getvisibility.com/system-upgrade-controller/v0.10.0/system-upgrade-controller.yaml
  5. Create upgrade-plan.yaml file.
    Note: The key version has the version of the K3s that the cluster will be upgraded to.
    cat > upgrade-plan.yaml << EOF
    ---
    apiVersion: upgrade.cattle.io/v1
    kind: Plan
    metadata:
      name: k3s-latest
      namespace: system-upgrade
    spec:
      concurrency: 1
      version: v1.24.9+k3s2
      nodeSelector:
        matchExpressions:
          - {key: k3s-upgrade, operator: Exists}
      serviceAccountName: system-upgrade
      upgrade:
        image: docker.io/rancher/k3s-upgrade
    EOF
  6. Run the upgrade plan.

    The upgrade controller should watch for this plan and execute the upgrade on the labeled nodes.

    kubectl apply -f upgrade-plan.yaml
  7. Once the plan is executed, all pods will restart and will take a few minutes to recover. Check the status of all the pods:
    watch kubectl get pods -A
  8. Check if the K3s version has been upgraded:
    kubectl get nodes
  9. Delete the system-upgrade-controller
    kubectl delete -f https://assets.master.k3s.getvisibility.com/system-upgrade-controller/v0.10.0/system-upgrade-controller.yaml