码迷,mamicode.com
首页 > Web开发 > 详细

kubernetes之二---基于kubeadm升级K8S版本

时间:2020-01-18 21:33:15      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:rootfs   说明   ons   github   oid   util   配置   node   connect   

升级kubernetes到指定版本实战

1、在master节点上查看此时的kubernetes的版本

因为是yum安装的kubernetes,需要查看此时的版本,然后再去官网查看1.14.1的最新版本是多少

[root@master ~]# rpm -qi  kubeadm
Name        : kubeadm
Version     : 1.14.1
Release     : 0
Architecture: x86_64
Install Date: Mon 13 Jan 2020 02:41:35 PM CST
Group       : Unspecified
Size        : 39588940
License     : ASL 2.0
Signature   : RSA/SHA512, Tue 09 Apr 2019 05:09:51 AM CST, Key ID f09c394c3e1ba8d5
Source RPM  : kubelet-1.14.1-0.src.rpm
Build Date  : Tue 09 Apr 2019 05:02:41 AM CST
Build Host  : bf8516edf970
Relocations : (not relocatable)
URL         : https://kubernetes.io
Summary     : Command-line utility for administering a Kubernetes cluster.
Description :
Command-line utility for administering a Kubernetes cluster.

github官方网站:https://github.com/kubernetes/kubernetes/tags 

2、在master上升级kubeadm到指定版本

1、在官网上查看此时1.14的最新版本是1.14.10版本,因此直接在master安装1.14.3版本的kubeadm

[root@master ~]# yum -y install kubeadm-1.14.3

2、在master查看kubeadm帮助

[root@master ~]# kubeadm upgrade --help
Upgrade your cluster smoothly to a newer version with this command.

Usage:
  kubeadm upgrade [flags]
  kubeadm upgrade [command]

Available Commands:
  apply       Upgrade your Kubernetes cluster to the specified version.
  diff        Show what differences would be applied to existing static pod manifests. See also: kubeadm upgrade apply --dry-run
  node        Upgrade commands for a node in the cluster. Currently only supports upgrading the configuration, not the kubelet itself.
  plan        Check which versions are available to upgrade to and validate whether your current cluster is upgradeable. To skip the internet check, pass in the optional [version] parameter.

Flags:
  -h, --help   help for upgrade

Global Flags:
      --log-file string   If non-empty, use this log file
      --rootfs string     [EXPERIMENTAL] The path to the ‘real‘ host root filesystem.
      --skip-headers      If true, avoid header prefixes in the log messages
  -v, --v Level           number for the log level verbosity

Use "kubeadm upgrade [command] --help" for more information about a command.
[root@master ~]# 

3、在master节点查看升级计划,验证是否可以升级到此版本

[root@master ~]# kubeadm upgrade plan
[preflight] Running pre-flight checks.
[upgrade] Making sure the cluster is healthy:
[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‘
[upgrade] Fetching available versions to upgrade to
[upgrade/versions] Cluster version: v1.14.1
[upgrade/versions] kubeadm version: v1.14.10
I0118 12:04:06.330170    5191 version.go:96] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable.txt": Get https://dl.k8s.io/release/stable.txt: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I0118 12:04:06.330206    5191 version.go:97] falling back to the local client version: v1.14.10
[upgrade/versions] Latest stable version: v1.14.10
I0118 12:04:16.392134    5191 version.go:96] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.14.txt": Get https://dl.k8s.io/release/stable-1.14.txt: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I0118 12:04:16.392166    5191 version.go:97] falling back to the local client version: v1.14.10
[upgrade/versions] Latest version in the v1.14 series: v1.14.10

Components that must be upgraded manually after you have upgraded the control plane with ‘kubeadm upgrade apply‘:
COMPONENT   CURRENT       AVAILABLE
Kubelet     3 x v1.14.1   v1.14.3

Upgrade to the latest version in the v1.14 series:

COMPONENT            CURRENT   AVAILABLE
API Server           v1.14.1   v1.14.3  #可以看到此时要升级的版本
Controller Manager   v1.14.1   v1.14.3
Scheduler            v1.14.1   v1.14.3
Kube Proxy           v1.14.1   v1.14.3
CoreDNS              1.3.1     1.3.1
Etcd                 3.3.10    3.3.3

You can now apply the upgrade by executing the following command:

	kubeadm upgrade apply v1.14.3

4、在master节点开始升级到指定的版本

[root@master ~]# kubeadm upgrade  apply v1.14.3

 显示以下框的内容就说明已经升级成功!!!

 技术图片

 技术图片

 5、在master节点上升级各node节点配置文件

[root@master ~]# kubeadm upgrade node config --kubelet-version 1.14.3
[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.

3、在各个node节点上安装最新版本的kubeadm、kubelet、kubectl包

[root@node1 ~]# yum -y install kubelet-1.14.3  kubeadm-1.14.3 kubectl-1.14.3
[root@node2 ~]# yum -y install kubelet-1.14.3  kubeadm-1.14.3 kubectl-1.14.3

4、验证最后K8S升级后的版本    

[root@master network-scripts]# kubectl get node
NAME     STATUS   ROLES    AGE   VERSION
master   Ready    master   21m   v1.14.3
node1    Ready    <none>   20m   v1.14.3
node2    Ready    <none>   20m   v1.14.3

  

  

  

 

 

 

kubernetes之二---基于kubeadm升级K8S版本

标签:rootfs   说明   ons   github   oid   util   配置   node   connect   

原文地址:https://www.cnblogs.com/struggle-1216/p/12209150.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!