# 升级 Windows 节点

LLMS index: [llms.txt](/llms.txt)

---

<!--
title: Upgrading Windows nodes
min-kubernetes-server-version: 1.17
content_type: task
weight: 41
-->

<!-- overview -->








  <div class="feature-state-notice feature-beta">
      <span class="feature-state-name">特性状态：</span>
      <code>Kubernetes v1.18 [beta]</code>
    </div>
  



<!--
This page explains how to upgrade a Windows node created with kubeadm.
-->
本页解释如何升级用 kubeadm 创建的 Windows 节点。

## 准备开始
 
<!--
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.
-->
<p>你必须有 Shell 能访问所有节点，且必须配置 kubectl 命令行工具让其与你的集群通信。
建议运行本教程的集群至少有两个节点，且这两个节点不能作为控制平面主机。</p>
 
 
 你的 Kubernetes 服务器版本必须不低于版本 1.17.
  <p>要获知版本信息，请输入  <code>kubectl version</code>.</p>


<!--
* Familiarize yourself with [the process for upgrading the rest of your kubeadm
cluster](/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade). You will want to
upgrade the control plane nodes before upgrading your Windows nodes.
-->
* 熟悉[更新 kubeadm 集群中的其余组件](/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade)。
  在升级你的 Windows 节点之前你会想要升级控制面节点。

<!-- steps -->
<!--
## Upgrading worker nodes

### Upgrade kubeadm
-->
## 升级工作节点   {#upgrading-worker-nodes}

### 升级 kubeadm    {#upgrade-kubeadm}

<!--
1.  From the Windows node, upgrade kubeadm:

    ```powershell
    # replace 1.36.0 with your desired version
    curl.exe -Lo <path-to-kubeadm.exe>  "https://dl.k8s.io/v1.36.0/bin/windows/amd64/kubeadm.exe"
    ```
-->
1. 在 Windows 节点上升级 kubeadm：

   ```powershell
   # 将 1.36.0 替换为你希望的版本
   curl.exe -Lo <kubeadm.exe 路径>  "https://dl.k8s.io/v1.36.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:

    ```shell
    # replace <node-to-drain> with the name of your node you are draining
    kubectl drain <node-to-drain> --ignore-daemonsets
    ```

    You should see output similar to this:

    ```
    node/ip-172-31-85-18 cordoned
    node/ip-172-31-85-18 drained
    ```
-->
### 腾空节点   {#drain-the-node}

1. 在一个能访问到 Kubernetes API 的机器上，将 Windows 节点标记为不可调度并
   驱逐其上的所有负载，以便准备节点维护操作：

   ```shell
   # 将 <要腾空的节点> 替换为你要腾空的节点的名称
   kubectl drain <要腾空的节点> --ignore-daemonsets
   ```

   你应该会看到类似下面的输出：

   ```
   node/ip-172-31-85-18 cordoned
   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:

    ```powershell
    kubeadm upgrade node
    ```
-->
### 升级 kubelet 配置   {#upgrade-the-kubelet-configuration}

1. 在 Windows 节点上，执行下面的命令来同步新的 kubelet 配置：

   ```powershell
   kubeadm upgrade node
   ```

<!--
### Upgrade kubelet and kube-proxy

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

    ```powershell
    stop-service kubelet
    curl.exe -Lo <path-to-kubelet.exe> "https://dl.k8s.io/v1.36.0/bin/windows/amd64/kubelet.exe"
    restart-service kubelet
    ```
-->
### 升级 kubelet 和 kube-proxy   {#upgrade-kubelet-and-kube-proxy}

1. 在 Windows 节点上升级并重启 kubelet：

   ```powershell
   stop-service kubelet
   curl.exe -Lo <kubelet.exe 路径> "https://dl.k8s.io/v1.36.0/bin/windows/amd64/kubelet.exe"
   restart-service kubelet
   ```

<!--
2. From the Windows node, upgrade and restart the kube-proxy.

    ```powershell
    stop-service kube-proxy
    curl.exe -Lo <path-to-kube-proxy.exe> "https://dl.k8s.io/v1.36.0/bin/windows/amd64/kube-proxy.exe"
    restart-service kube-proxy
    ```
-->
2. 在 Windows 节点上升级并重启 kube-proxy：

   ```powershell
   stop-service kube-proxy
   curl.exe -Lo <kube-proxy.exe 路径> "https://dl.k8s.io/v1.36.0/bin/windows/amd64/kube-proxy.exe"
   restart-service kube-proxy
   ```


<div class="alert alert-info" role="note"><h4 class="alert-heading">说明：</h4><!--
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.
-->
<p>如果你是在 Pod 内的 HostProcess 容器中运行 kube-proxy，而不是作为 Windows 服务，
你可以通过应用更新版本的 kube-proxy 清单文件来升级 kube-proxy。</p></div>


<!--
### Uncordon the node

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

    ```shell
    # replace <node-to-drain> with the name of your node
    kubectl uncordon <node-to-drain>
    ```
-->
### 对节点执行 uncordon 操作   {#uncordon-the-node}

1. 从一台能够访问到 Kubernetes API 的机器上，通过将节点标记为可调度，使之
   重新上线：

   ```shell
   # 将 <要腾空的节点> 替换为你的节点名称
   kubectl uncordon <要腾空的节点>
   ```

## 接下来

<!--
* See how to [Upgrade Linux nodes](/docs/tasks/administer-cluster/kubeadm/upgrading-linux-nodes/).
-->

* 查看如何[升级 Linux 节点](/zh-cn/docs/tasks/administer-cluster/kubeadm/upgrading-linux-nodes/)。
