Files
Guangwen Feng def9ee13f6 [zh-cn] Refresh kubeadm docs for Windows
Signed-off-by: Guangwen Feng <fenggw-fnst@fujitsu.com>
2022-06-29 09:24:05 +08:00

180 lines
5.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 升级 Windows 节点
min-kubernetes-server-version: 1.17
content_type: task
weight: 40
---
<!--
title: Upgrading Windows nodes
min-kubernetes-server-version: 1.17
content_type: task
weight: 40
-->
<!-- overview -->
{{< feature-state for_k8s_version="v1.18" state="beta" >}}
<!--
This page explains how to upgrade a Windows node [created with kubeadm](/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes).
-->
本页解释如何升级[用 kubeadm 创建的](/zh-cn/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes)
Windows 节点。
## {{% heading "prerequisites" %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
<!--
* 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 {{< param "fullversion" >}} with your desired version
curl.exe -Lo <path-to-kubeadm.exe> https://dl.k8s.io/{{< param "fullversion" >}}/bin/windows/amd64/kubeadm.exe
```
-->
1. 在 Windows 节点上升级 kubeadm
```powershell
# 将 {{< param "fullversion" >}} 替换为你希望的版本
curl.exe -Lo <kubeadm.exe 路径> https://dl.k8s.io/{{< param "fullversion" >}}/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/{{< param "fullversion" >}}/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/{{< param "fullversion" >}}/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/{{< param "fullversion" >}}/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/{{< param "fullversion" >}}/bin/windows/amd64/kube-proxy.exe
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.
-->
如果你是在 Pod 内的 HostProcess 容器中运行 kube-proxy,而不是作为 Windows 服务,
你可以通过应用更新版本的 kube-proxy 清单文件来升级 kube-proxy。
{{< /note >}}
<!--
### 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 <要腾空的节点>
```