Upgrading Windows nodes

FEATURE STATE: Kubernetes v1.18 [beta]

This page explains how to upgrade a Windows node created with kubeadm.

Before you begin

You need to have shell access to all the nodes, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts.

Your Kubernetes server must be at or later than version 1.17. To check the version, enter kubectl version.

Upgrading worker nodes

Upgrade kubeadm

  1. From the Windows node, upgrade kubeadm:

    1. # replace 1.31.0 with your desired version
    2. curl.exe -Lo <path-to-kubeadm.exe> "https://dl.k8s.io/v1.31.0/bin/windows/amd64/kubeadm.exe"

Drain the node

  1. From a machine with access to the Kubernetes API, prepare the node for maintenance by marking it unschedulable and evicting the workloads:

    1. # replace <node-to-drain> with the name of your node you are draining
    2. kubectl drain <node-to-drain> --ignore-daemonsets

    You should see output similar to this:

    1. node/ip-172-31-85-18 cordoned
    2. node/ip-172-31-85-18 drained

Upgrade the kubelet configuration

  1. From the Windows node, call the following command to sync new kubelet configuration:

    1. kubeadm upgrade node

Upgrade kubelet and kube-proxy

  1. From the Windows node, upgrade and restart the kubelet:

    1. stop-service kubelet
    2. curl.exe -Lo <path-to-kubelet.exe> "https://dl.k8s.io/v1.31.0/bin/windows/amd64/kubelet.exe"
    3. restart-service kubelet
  2. From the Windows node, upgrade and restart the kube-proxy.

    1. stop-service kube-proxy
    2. curl.exe -Lo <path-to-kube-proxy.exe> "https://dl.k8s.io/v1.31.0/bin/windows/amd64/kube-proxy.exe"
    3. restart-service kube-proxy

Note:

If you are running kube-proxy in a HostProcess container within a Pod, and not as a Windows Service, you can upgrade kube-proxy by applying a newer version of your kube-proxy manifests.

Uncordon the node

  1. From a machine with access to the Kubernetes API, bring the node back online by marking it schedulable:

    1. # replace <node-to-drain> with the name of your node
    2. kubectl uncordon <node-to-drain>

What’s next