我正在CI / CD管道的docker(-compose)容器中使用K3S群集,以测试我的应用程序代码。但是我对群集的证书有疑问。我需要使用外部地址在群集上进行通信。我的docker-compose脚本如下所示
version: '3'
services:
server:
image: rancher/k3s:v0.8.1
command: server --disable-agent
environment:
- K3S_CLUSTER_SECRET=somethingtotallyrandom
- K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml
- K3S_KUBECONFIG_MODE=666
volumes:
- k3s-server:/var/lib/rancher/k3s
# get the kubeconfig file
- .:/output
ports:
# - 6443:6443
- 6080:6080
- 192.168.2.110:6443:6443
node:
image: rancher/k3s:v0.8.1
tmpfs:
- /run
- /var/run
privileged: true
environment:
- K3S_URL=https://server:6443
- K3S_CLUSTER_SECRET=somethingtotallyrandom
ports:
- 31000-32000:31000-32000
volumes:
k3s-server: {}
从python访问集群给了我
MaxRetryError: HTTPSConnectionPool(host='192.168.2.110', port=6443): Max retries exceeded with url: /apis/batch/v1/namespaces/mlflow/jobs?pretty=True (Caused by SSLError(SSLCertVerificationError("hostname '192.168.2.110' doesn't match either of 'localhost', '172.19.0.2', '10.43.0.1', '172.23.0.2', '172.18.0.2', '172.23.0.3', '127.0.0.1', '0.0.0.0', '172.18.0.3', '172.20.0.2'")))
这是我的两个(三个)问题
--bind-address
会触发taht --http-listen-port
未能达到预期的结果,我该如何依靠http:// lili
更改python代码并不是真正的选择,因为我希望o保持代码不变以进行测试。 (http上的Fallback通过kubeconfig起作用。
答案 0 :(得分:0)
解决方案是使用参数tls-san
server --disable-agent --tls-san 192.168.2.110