kubernetes:Unable to connect to the server: x509

背景:

Unable to connect to the server: x509: certificate is valid for 10.96.0.1, 10.0.1.76, not 119.28.78.191

报错原因:

Connection error: Get https://119.28.78.191:6443/api/v1/namespaces/default/pods?limit=500: x509: certificate is valid for 10.96.0.1, 10.0.1.76, not 119.28.78.191

由于我使用的是云主机,k8s证书签名的时候签的是内网ip,并不是eip,外网ip ,所以证书认证失败,跳过证书认证即可
解决办法:

 kubectl get po  --insecure-skip-tls-verify
 % kubectl get po  --insecure-skip-tls-verify
NAME                                  READY   STATUS    RESTARTS   AGE
busybox-cd8b7db95-rvn9p               1/1     Running   1          4d4h
demotest-helmtest-5dc8649987-jzgfb    1/1     Running   0          23h
demotest2-helmtest-55585789d5-6cpz6   1/1     Running   0          23h
helmtest-1-7f86dd445b-2htjn           1/1     Running   0          3d17h
helmtest-bcb4854b6-phtbg              1/1     Running   0          3d17h

你可能感兴趣的:(kubernetes)