Unable to connect to the server: x509: certificate signed by unknown authority

unable to recognize "csis-service.yaml": Get https://xx.xx.xxx.xxx:xxxx/api?timeout=32s: x509: 
certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")
unable to recognize "csis-service.yaml": Get https://xx.xx.xxx.xxx:xxxx/api?timeout=32s: x509: 
certificate signed by unknown authority (possibly because of "crypto/rsa: 
verification error" while trying to verify candidate authority certificate "kubernetes")
Unable to connect to the server: x509: certificate signed by unknown authority 
(possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")

原因:

我这是通过 gitlab-runner 来运行打包项目
gitlab-runner 用户在执行时由于 k8s 授权异常报错

解决方法:

切换 gitlab-runner 用户把 k8s 授权文件放进去

#找到授权文件
cd ~
ls -a
#可以看到有个叫 .kube 的文件夹,一整个下载下来
#切换 gitlab-runner 用户
su gitlab-runner
cd ~
#然后上传刚的 .kube 文件夹,整个解压
#验证授权成功
kubectl get node

 

你可能感兴趣的:(#,Git/GitLab,#,Kubernetes,Exception)