- 检查可用于升级的版本,并验证当前集群是否可升级。要跳过互联网检查,请传入可选参数[version].
kubeadm upgrade plan [version] [flags]
默认情况下kubeadm 访问的https://dl.k8s.io/release/stable.txt
地址会被rewrite https://storage.googleapis.com/kubernetes-release/release/stable.txt
获取当前的稳定版本,需要提子。
- master 安装需要升级到特定版本的kubeadm版本
yum install kubeadm-1.14.3-0.x86_64
- 在master节点上执行升级集群的configmap操作
kubeadm upgrade apply 1.14.3
看到如下结果表示成功:
[kubelet] Creating a ConfigMap "kubelet-config-1.14" in namespace kube-system with the configuration for the kubelets in the cluster
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.14" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy
[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.14.3". Enjoy!
[upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.
- 升级节点配置
从集群ConfigMap kubelet-config-1.x下载kubelet配置,其中X是kubelet的次要版本。
从集群中kubelete-config-1.x,形式的ConfigMap下载kubelet配置,其中X是kubelet的次版本。
kubeadm upgrade node config [flags]
例如:
# Downloads the kubelet configuration from the ConfigMap in the cluster. Uses a specific desired kubelet version.
kubeadm upgrade node config --kubelet-version 1.14.0
# Simulates the downloading of the kubelet configuration from the ConfigMap in the cluster with a specific desired
# version. Does not change any state locally on the node.
kubeadm upgrade node config --kubelet-version 1.14.0 --dry-run
成功后会看到一下提示:
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.14" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[upgrade] The configuration for this node was successfully updated!
[upgrade] Now you should go ahead and upgrade the kubelet package using your package manager.
5.升级节点的kubeadm版本到v1.14.3
yum install kubeadm-1.14.3-0.x86_64
安装完成后重启kubelet