KubeSphere 镜像构建器(S2I)服务证书过期解决方案
目前 KubeSphere 所有 3.x.x 版本,如果开启了 DevOps 模块并使用了镜像构建器功能(S2I)都会遇到证书过期问题。
解决方法
已开启 DevOps 模块
下载这个更新 S2I 服务证书压缩包,上传到任一可以访问 K8s 集群的节点;
- 把上传的压缩包解压
- 进入解压后的目录
- 执行更新证书的脚本 ./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 这几个版本,可以使用下面的方式来解决此问题:
- 获取 ks-installer 镜像
- 更新 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 发布!
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
2023-02-21 修复 K8s SSL/TLS 漏洞(CVE-2016-2183)指南