伍佰目录 短网址
  当前位置:海洋目录网 » 站长资讯 » 站长资讯 » 文章详细 订阅RssFeed

升级kubeadm部署的k8s集群

来源:本站原创 浏览:112次 时间:2022-07-30
升级kubeadm部署的k8s集群

K爷 DevOps视角

升级k8s集群

使用kubeadm部署kubernetes集群介绍了使用kubeadm快速部署k8s集群,这篇文章将升级k8s集群。

此升级方法仅适用于使用kubeadm部署的k8s集群。

升级kubeadm

升级k8s集群必须先升级kubeadm版本到要升级的版本。即要升级kubeadm部署的k8s级群,必须先升级kubeadm版本。

# kubeadm versionkubeadm version: &version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.2", GitCommit:"59603c6e503c87169aea6106f57b9f242f64df89", GitTreeState:"clean", BuildDate:"2020-01-18T23:27:49Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"}
各master升级到目的版本kubeadm
  • 升级kubeadm
# apt-cache madison kubeadm# apt-get install kubeadm=1.17.4-00# kubeadm versionkubeadm version: &version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.4", GitCommit:"8d8aa39598534325ad77120c120a22b3a990b5ea", GitTreeState:"clean", BuildDate:"2020-03-12T21:01:11Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
  • 查看升级计划
# kubeadm upgrade plan[upgrade/config] Making sure the configuration is correct:[upgrade/config] Reading configuration from the cluster...[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'[preflight] Running pre-flight checks.[upgrade] Making sure the cluster is healthy:[upgrade] Fetching available versions to upgrade to[upgrade/versions] Cluster version: v1.17.2[upgrade/versions] kubeadm version: v1.17.4I0723 15:10:34.814329   40861 version.go:251] remote version is much newer: v1.18.6; falling back to: stable-1.17[upgrade/versions] Latest stable version: v1.17.9[upgrade/versions] Latest version in the v1.17 series: v1.17.9Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':COMPONENT   CURRENT       AVAILABLEKubelet     6 x v1.17.2   v1.17.9Upgrade to the latest version in the v1.17 series:COMPONENT            CURRENT   AVAILABLEAPI Server           v1.17.2   v1.17.9Controller Manager   v1.17.2   v1.17.9Scheduler            v1.17.2   v1.17.9Kube Proxy           v1.17.2   v1.17.9CoreDNS              1.6.5     1.6.5Etcd                 3.4.3     3.4.3-0You can now apply the upgrade by executing the following command:        kubeadm upgrade apply v1.17.9Note: Before you can perform this upgrade, you have to update kubeadm to v1.17.9.
升级master

在各个master节点进行升级
master节点要一个一个升级,不要一起同时升级

# kubeadm upgrade apply v1.17.4......[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.17.4". Enjoy![upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.# docker images|grep v1.17.4registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy                v1.17.4             6dec7cfde1e5        4 months ago        116MBregistry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver            v1.17.4             2e1ba57fe95a        4 months ago        171MBregistry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager   v1.17.4             7f997fcf3e94        4 months ago        161MBregistry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler            v1.17.4

升级kubelet和kubectl

# apt install kubelet=1.17.4-00 kubectl=1.17.4-00
升级node节点

查看当前node 版本

# kubectl get nodeNAME          STATUS   ROLES    AGE   VERSIONk8s-master1   Ready    master   25h   v1.17.4k8s-master2   Ready    master   24h   v1.17.4k8s-master3   Ready    master   24h   v1.17.4k8s-node1     Ready    <none>   23h   v1.17.2k8s-node2     Ready    <none>   23h   v1.17.2k8s-node3     Ready    <none>   23h   v1.17.2

升级node节点配置文件

# kubeadm upgrade node --kubelet-version 1.17.4[upgrade] Reading configuration from the cluster...[upgrade] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'[upgrade] Skipping phase. Not a control plane node.[upgrade] Using kubelet config version 1.17.4, while kubernetes-version is v1.17.4[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.17" 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.

升级node节点的kubelet、kubeadm

# apt install kubelet=1.17.4-00 kubeadm=1.17.4-00

查看node

# kubectl get nodeNAME          STATUS   ROLES    AGE   VERSIONk8s-master1   Ready    master   25h   v1.17.4k8s-master2   Ready    master   24h   v1.17.4k8s-master3   Ready    master   24h   v1.17.4k8s-node1     Ready    <none>   24h   v1.17.4k8s-node2     Ready    <none>   24h   v1.17.4k8s-node3     Ready    <none>   24h   v1.17.4

  推荐站点

  • At-lib分类目录At-lib分类目录

    At-lib网站分类目录汇集全国所有高质量网站,是中国权威的中文网站分类目录,给站长提供免费网址目录提交收录和推荐最新最全的优秀网站大全是名站导航之家

    www.at-lib.cn
  • 中国链接目录中国链接目录

    中国链接目录简称链接目录,是收录优秀网站和淘宝网店的网站分类目录,为您提供优质的网址导航服务,也是网店进行收录推广,站长免费推广网站、加快百度收录、增加友情链接和网站外链的平台。

    www.cnlink.org
  • 35目录网35目录网

    35目录免费收录各类优秀网站,全力打造互动式网站目录,提供网站分类目录检索,关键字搜索功能。欢迎您向35目录推荐、提交优秀网站。

    www.35mulu.com
  • 就要爱网站目录就要爱网站目录

    就要爱网站目录,按主题和类别列出网站。所有提交的网站都经过人工审查,确保质量和无垃圾邮件的结果。

    www.912219.com
  • 伍佰目录伍佰目录

    伍佰网站目录免费收录各类优秀网站,全力打造互动式网站目录,提供网站分类目录检索,关键字搜索功能。欢迎您向伍佰目录推荐、提交优秀网站。

    www.wbwb.net