gpt4 book ai didi

ubuntu - microk8s,DEVOPS : Unable to connect to the server: x509: certificate is valid for , 不是 <外部 IP>

转载 作者:行者123 更新时间:2023-12-04 14:39:40 29 4
gpt4 key购买 nike

我在 ubuntu 笔记本电脑上有一个 microk8s 集群。
我想从 azure devops 管道对其应用部署 yaml 文件。
我已经在我的 devops 中成功定义了一个 Kubernetes 服务连接,并且它通过了验证。虽然当我尝试应用 yaml 文件时,我得到了这些行

/usr/bin/kubectl apply -f /home/vsts/work/1/s/devops/deploymen.yaml -o json


##[error]Unable to connect to the server: x509: certificate is valid for 127.0.0.1, 10.152.183.1, 192.168.50.69, 172.17.0.1, 10.1.80.0, not <my external IP>
192.168.50.69 是我网络中笔记本电脑的 ip
我应该在哪里添加我的外部 IP?
编辑:
我找到了 Authentication and authorization我编辑了 /var/snap/microk8s/current/certs/csr.conf.template所以它现在包括我的IP。
文章说:

After changing, the apiserver-kicker will automatically detect the difference, generate new certs and restart the apiserver. Your DNS server settings and kubeconfig file must be updated appropriately.


certificate-authority-data /var/snap/microk8s/current/certs/ca.crt 中的证书现在看起来与 microk8s config 中的不同
我还更新了 kubeconfig 如上所述
但还是没有运气!

最佳答案

这些问题的解决方案是修改模板并添加缺少的IP地址/var/snap/microk8s/current/certs/csr.conf.template

...

[ alt_names ]
DNS.1 = kubernetes
DNS.2 = kubernetes.default
DNS.3 = kubernetes.default.svc
DNS.4 = kubernetes.default.svc.cluster
DNS.5 = kubernetes.default.svc.cluster.local
IP.1 = 127.0.0.1
IP.2 = 192.168.1.1
IP.100 = 192.168.1.1 # USE IP > 100
#MOREIPS

...

When you modify this template files, microk8s daemon generates a new csr.conf


发生这种情况是因为如果您检查 sudo cat /var/snap/microk8s/current/certs/csr.conf文件您分配的 IP 的 ID 被另一个 IP 占用。
要解决此冲突,必须使用更高的 ID,这将起作用

关于ubuntu - microk8s,DEVOPS : Unable to connect to the server: x509: certificate is valid for <internal IPs>, 不是 <外部 IP>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63451290/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com