关于云计算:KubeSphere-镜像构建器S2I服务证书过期解决方案

5次阅读

共计 1731 个字符,预计需要花费 5 分钟才能阅读完成。

目前 KubeSphere 所有 3.x.x 版本,如果开启了 DevOps 模块并应用了镜像构建器性能(S2I)都会遇到证书过期问题。

解决办法

已开启 DevOps 模块

下载这个更新 S2I 服务证书压缩包,上传到任一能够拜访 K8s 集群的节点;

  1. 把上传的压缩包解压
  2. 进入解压后的目录
  3. 执行更新证书的脚本 ./update-s2i-cert.sh
# 上传压缩包到可拜访 k8s 集群的节点
...
# 解压缩
$ tar -zxvf update-s2i-cert.tar.gz
update-s2i-cert/
update-s2i-cert/config/
update-s2i-cert/config/certs/
update-s2i-cert/config/certs/server.crt
update-s2i-cert/config/certs/ca.crt
update-s2i-cert/config/certs/server.key
update-s2i-cert/update-s2i-cert.sh
 
# 执行更新证书脚本
$ cd update-s2i-cert
$ ./update-s2i-cert.sh
Update Secret: s2i-webhook-server-cert..
secret/s2i-webhook-server-cert patched
Update ValidatingWebhookConfiguration validating-webhook-configuration..
validatingwebhookconfiguration.admissionregistration.k8s.io/validating-webhook-configuration patched
Update MutatingWebhookConfiguration mutating-webhook-configuration..
mutatingwebhookconfiguration.admissionregistration.k8s.io/mutating-webhook-configuration patched
Restart s2ioperator server..
statefulset.apps/s2ioperator restarted
Done.
...

执行完下面 3 步后,期待 pod s2ioperator-0 重启胜利就能够了。

未开启 DevOps 模块

在曾经创立的 KubeSphere 环境里,还未开启 DevOps 模块,如果须要开启 DevOps 模块,也会遇到因为 S2I 证书过期导致开启 DevOps 模块失败的状况。

上面针对 KubeSphere 3.3.0、3.3.1、3.3.2、3.4.0、3.4.1 这几个版本,能够应用上面的形式来解决此问题:

  1. 获取 ks-installer 镜像
  2. 更新 ks-installer 镜像
# 执行上面命令,获取 ks-installer 镜像
$ kubectl -n kubesphere-system get deployments ks-installer --no-headers -o custom-columns=:.spec.template.spec.containers[0].image
kubesphere/ks-installer:v3.3.0
 
# 基于获取的镜像,在镜像最初加上‘-patch.0’,执行上面命令更新 ks-installer 镜像
$ kubectl -n kubesphere-system patch deployments ks-installer --type='json' -p='[{"op":"replace","path":"/spec/template/spec/containers/0/image","value":"kubesphere/ks-installer:v3.3.0-patch.0"}]'

更新镜像后 ks-installer 会主动重启并依据 ClusterConfiguration 里的配置装置各个开启的未装置的模块。

如果上述计划未能解决您的问题,请移步论坛交换:https://ask.kubesphere.io/forum/。

本文由博客一文多发平台 OpenWrite 公布!

正文完
 0