Kubernetes v1.18 [beta]本页面说明了如何升级使用 kubeadm 创建的 Windows 节点。
你需要拥有所有节点的 Shell 访问权限,并且必须配置 kubectl 命令行工具以与集群进行通信。建议在一个至少有两个不作为控制平面主机节点的集群上运行本教程。
你的 Kubernetes 服务器版本必须在 1.17 或更高版本。要检查版本,请输入 kubectl version。
在 Windows 节点上,升级 kubeadm
# 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"
在拥有访问 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
在 Windows 节点上,调用以下命令以同步新的 kubelet 配置
kubeadm upgrade node
在 Windows 节点上,升级并重启 kubelet
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
在 Windows 节点上,升级并重启 kube-proxy。
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
在拥有访问 Kubernetes API 权限的机器上,通过将节点标记为可调度,使节点重新上线
# replace <node-to-drain> with the name of your node
kubectl uncordon <node-to-drain>