升级 Windows 节点
特性状态:
Kubernetes v1.18 [beta]
本页介绍如何升级使用 kubeadm 创建的 Windows 节点。
开始之前
你需要拥有对所有节点的 shell 访问权限,并且必须配置 kubectl 命令行工具以与你的集群通信。建议在至少有两个不充当控制平面主机的节点的集群上运行本教程。
你的 Kubernetes 服务器必须是 1.17 或更高版本。要检查版本,请输入kubectl version
。- 熟悉升级 kubeadm 集群其余部分的过程。你需要在升级 Windows 节点之前升级控制平面节点。
升级工作节点
升级 kubeadm
从 Windows 节点,升级 kubeadm
# replace 1.32.0 with your desired version curl.exe -Lo <path-to-kubeadm.exe> "https://dl.k8s.io/v1.32.0/bin/windows/amd64/kubeadm.exe"
排空节点
从可以访问 Kubernetes API 的机器,通过将节点标记为不可调度并驱逐工作负载来准备节点进行维护
# replace <node-to-drain> with the name of your node you are draining kubectl drain <node-to-drain> --ignore-daemonsets
你应该看到类似于以下的输出
node/ip-172-31-85-18 cordoned node/ip-172-31-85-18 drained
升级 kubelet 配置
从 Windows 节点,调用以下命令以同步新的 kubelet 配置
kubeadm upgrade node
升级 kubelet 和 kube-proxy
从 Windows 节点,升级并重启 kubelet
stop-service kubelet curl.exe -Lo <path-to-kubelet.exe> "https://dl.k8s.io/v1.32.0/bin/windows/amd64/kubelet.exe" restart-service kubelet
从 Windows 节点,升级并重启 kube-proxy。
stop-service kube-proxy curl.exe -Lo <path-to-kube-proxy.exe> "https://dl.k8s.io/v1.32.0/bin/windows/amd64/kube-proxy.exe" restart-service kube-proxy
注意
如果你在 Pod 内的 HostProcess 容器中运行 kube-proxy,而不是作为 Windows 服务运行,则可以通过应用较新版本的 kube-proxy 清单来升级 kube-proxy。解除节点隔离
从可以访问 Kubernetes API 的机器,通过将节点标记为可调度来使节点恢复在线
# replace <node-to-drain> with the name of your node kubectl uncordon <node-to-drain>
下一步
- 了解如何升级 Linux 节点。
上次修改时间:2024 年 9 月 13 日下午 4:59 PST:重新组织 kubeadm 节点任务 (c8bb00db5d)