Skip to main content
This guide covers upgrading Kubernetes on Talos Linux clusters. For a list of Kubernetes versions compatible with each Talos release, see the Support Matrix. For upgrading the Talos Linux operating system, see Upgrading Talos

Video Walkthrough

To see a demo of this process, watch this video:

Automated Kubernetes Upgrade

The recommended method to upgrade Kubernetes is to use the talosctl upgrade-k8s command. This will automatically update the components needed to upgrade Kubernetes safely. Upgrading Kubernetes is non-disruptive to the cluster workloads. To trigger a Kubernetes upgrade, issue a command specifying the version of Kubernetes to ugprade to, such as: talosctl --nodes <controlplane node> upgrade-k8s --to ${k8s_release} Note that the --nodes parameter specifies the control plane node to send the API call to, but all members of the cluster will be upgraded. To check what will be upgraded you can run talosctl upgrade-k8s with the --dry-run flag: To upgrade Kubernetes from k8sprevreleasetov{k8s_prev_release} to v run: This command runs in several phases:
  1. Images for new Kubernetes components are pre-pulled to the nodes to minimize downtime and test for image availability.
  2. Every control plane node machine configuration is patched with the new image version for each control plane component. Talos renders new static pod definitions on the configuration update which is picked up by the kubelet. The command waits for the change to propagate to the API server state.
  3. The command updates the kube-proxy daemonset with the new image version.
  4. On every node in the cluster, the kubelet version is updated. The command then waits for the kubelet service to be restarted and become healthy. The update is verified by checking the Node resource state.
  5. Kubernetes bootstrap manifests are re-applied to the cluster. Updated bootstrap manifests might come with a new Talos version (e.g. CoreDNS version update), or might be the result of machine configuration change.
Note: The upgrade-k8s command never deletes any resources from the cluster: they should be deleted manually.
If the command fails for any reason, it can be safely restarted to continue the upgrade process from the moment of the failure.
Note: When using custom/overridden Kubernetes component images, use flags --*-image to override the default image names.

Synchronize Declared and Deployed Configurations

When Kubernetes is upgraded with talosctl upgrade-k8s, the live machine configuration on your nodes is updated with new component image versions (API server, controller manager, scheduler, kube-proxy, etc.). If you are storing full machine configuration files (controlplane.yaml, worker.yaml) in Git, these versions will drift out of sync. Re-applying those stale files later could unintentionally downgrade components. That is why we do not recommend storing full machine configurations. Version numbers for Talos, etcd, Kubernetes components, and add-ons change frequently. Maintaining these across upgrades requires editing many fields by hand. See the Reproducible Machine Configuration guide for full instructions on handling machine configurations after version bumps.

Manual Kubernetes Upgrade

Kubernetes can be upgraded manually by following the steps outlined below. They are equivalent to the steps performed by the talosctl upgrade-k8s command.

Kubeconfig

In order to edit the control plane, you need a working kubectl config. If you don’t already have one, you can get one by running:

API Server

Patch machine configuration using talosctl patch command:
The JSON patch might need to be adjusted if current machine configuration is missing .cluster.apiServer.image key. Also the machine configuration can be edited manually with talosctl -n <IP> edit mc --mode=no-reboot. Capture the new version of kube-apiserver config with:
In this example, the new version is 5. Wait for the new pod definition to propagate to the API server state (replace talos-default-controlplane-1 with the node name):
Check that the pod is running:
Repeat this process for every control plane node, verifying that state got propagated successfully between each node update.

Controller Manager

Patch machine configuration using talosctl patch command:
The JSON patch might need be adjusted if current machine configuration is missing .cluster.controllerManager.image key. Capture new version of kube-controller-manager config with:
In this example, new version is 3. Wait for the new pod definition to propagate to the API server state (replace talos-default-controlplane-1 with the node name):
Check that the pod is running:
Repeat this process for every control plane node, verifying that state propagated successfully between each node update.

Scheduler

Patch machine configuration using talosctl patch command:
JSON patch might need be adjusted if current machine configuration is missing .cluster.scheduler.image key. Capture new version of kube-scheduler config with:
In this example, new version is 3. Wait for the new pod definition to propagate to the API server state (replace talos-default-controlplane-1 with the node name):
Check that the pod is running:
Repeat this process for every control plane node, verifying that state got propagated successfully between each node update.

Proxy

In the proxy’s DaemonSet, change:
to:
To edit the DaemonSet, run:

Bootstrap Manifests

Bootstrap manifests can be retrieved in a format which works for kubectl with the following command:
Diff the manifests with the cluster:
Apply the manifests:
Note: if some bootstrap resources were removed, they have to be removed from the cluster manually.

kubelet

For every node, patch machine configuration with new kubelet version, wait for the kubelet to restart with new version:
Once kubelet restarts with the new configuration, confirm upgrade with kubectl get nodes <name>: