背景
目前公司在用的k8s+kubesphere的版本是v1.19.9+v3.2.1,k8s版本已经相对较老,因此选择使用kk将k8s的版本升级至v1.23.17。
写在前面
修改成国内源
按照官网给的方法,升级前,请执行以下命令:
export KKZONE=cn
此环境变量,能够让kk知道,咱们这是国内环境,自动会切换到国内的源进行下载。有梯子的公司,可以忽略哈。
修改local_registry地址
原来使用kk安装时,配置了local_registry的话,就需要按照本章节,将local_registry配置去掉,不然无法正常在线升级。
修改installer配置
进入定制资源定义,搜索install,进去修改配置。
将local_registry设置成空。
修改配置字典
检查kubesphere-system、kube-system两个命名空间下的配置字典,存在local_registry镜像地址的,将local_registry地址去掉。
多节点集群
按照官网文档,首先生成sample.yaml。
./kk create config --from-cluster
yaml文件中,只要修改了红框中的四处。
修改完毕后,使用升级命令进行升级。
./kk upgrade --with-kubernetes v1.23.17 --with-kubesphere v3.3.2 -f sample.yaml
运行一段时间后,出现报错。
再一次执行升级命令,这次看上去正常了。根据日志显示,这一次是从1.21.5升级到1.23.17,说明刚刚失败的时候,其实已经装好了1.21.5。
结果一会儿,又报错了,错误如下:
此时看kubesphere后台,其实都已经正常了,我怀疑其实已经装完了。这时,我第三次执行了升级命令。得到了如下安装成功的提示。
所以,kk使用过程中,如果失败了,就再多试几次,说不定就好了。
问题
1、执行升级命令后报 curl: (60) Peer's Certificate has expired.
完整的错误信息如下:
downloading amd64 kubeadm v1.20.10 ...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (60) Peer's Certificate has expired.
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
11:47:47 CST message: [LocalHost]
Failed to download kubeadm binary: curl -L -o /home/charts-07121114/base/kube-offline/upgrade/kubekey/kube/v1.20.10/amd64/kubeadm https://kubernetes-release.pek3b.qingstor.com/release/v1.20.10/bin/linux/amd64/kubeadm error: exit status 60
11:47:47 CST failed: [LocalHost]
error: Pipeline[UpgradeClusterPipeline] execute failed: Module[ProgressiveUpgradeModule 1/2] exec failed:
failed: [LocalHost] [DownloadBinaries] exec failed after 1 retries: Failed to download kubeadm binary: curl -L -o /home/charts-07121114/base/kube-offline/upgrade/kubekey/kube/v1.20.10/amd64/kubeadm https://kubernetes-release.pek3b.qingstor.com/release/v1.20.10/bin/linux/amd64/kubeadm error: exit status 60
这个问题是因为虚机的时间不对,校时后即可。
相关资料: