目前 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 發佈!