helm 部署出來的 KubeSphere console 是 http
如何配置成 https?
helm 部署出來的 KubeSphere console 是 http
如何配置成 https?
阿里嘎多学长整理AIGC生成,因移动端显示问题导致当前答案未能完全显示,请使用PC端查看更加详细的解答过程
KubeSphere 的 Web console 是使用 Helm 部署的,可以使用以下步骤将其配置为使用 HTTPS:
使用 OpenSSL 生成证书和私钥:
openssl req -x509 -newkey rsa:4096 -nodes -keyout kubesphere.crt -out kubesphere.crt -days 365 -subj "/C=CN/ST=State/L=Locality/O=Organization/CN=kubesphere.com"
使用 Helm 创建一个名为 kubesphere-certs 的 Secret,用于存储证书和私钥:
apiVersion: v1
kind: Secret
metadata:
name: kubesphere-certs
type: Opaque
data:
tls.crt: <base64 encoded certificate>
tls.key: <base64 encoded private key>
使用 Helm 更新 KubeSphere 的配置,添加 https 选项:
apiVersion: kubesphere.io/v1alpha1
kind: Kubesphere
metadata:
name: kubesphere
spec:
web:
https: true
tls:
crt: {{ .Values.kubesphere-certs.tls.crt }}
key: {{ .Values.kubesphere-certs.tls.key }}
使用 Helm 重新部署 KubeSphere:
helm upgrade kubesphere kubesphere/kubesphere --set kubesphere-certs.tls.crt=<base64 encoded certificate> --set kubesphere-certs.tls.key=<base64 encoded private key>
访问 KubeSphere 的 Web console,使用 HTTPS 协议(例如 https://kubesphere.com),验证是否可以成功访问。
注意:在上面的步骤中,需要将证书和私钥 base64 编码,并将其存储在 kubesphere-certs Secret 中。同时,需要更新 KubeSphere 的配置,添加 https 选项,并重新部署 KubeSphere。