Helm 3:连接到本地Kubernetes时出现x509错误 [英] Helm 3: x509 error when connecting to local Kubernetes

查看:219
本文介绍了Helm 3:连接到本地Kubernetes时出现x509错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是K8的完美菜鸟.我安装了 microk8s Helm 使用 snap 进行本地实验.我想知道我当前的问题是否来自 snap 的使用(根据我的理解,其目的是封装)

I'm a perfect noob with K8s. I installed microk8s and Helm using snap to experiment locally. I wonder whether my current issue comes from the use of snap (purpose of which is encapsulation, from what I understood)

Ubuntu 20.04LTS

Ubuntu 20.04LTS

helm version                                                                            
version.BuildInfo{Version:"v3.2.4", GitCommit:"0ad800ef43d3b826f31a5ad8dfbb4fe05d143688", GitTreeState:"clean", GoVersion:"go1.13.12"}
kubectl version     
Client Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.4-1+6f17be3f1fd54a", GitCommit:"6f17be3f1fd54a88681869d1cf8bedd5a2174504", GitTreeState:"clean", BuildDate:"2020-06-23T21:16:24Z", GoVersion:"go1.14.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.4-1+6f17be3f1fd54a", GitCommit:"6f17be3f1fd54a88681869d1cf8bedd5a2174504", GitTreeState:"clean", BuildDate:"2020-06-23T21:17:52Z", GoVersion:"go1.14.4", Compiler:"gc", Platform:"linux/amd64"}

kubectl config get-contexts                                                             
CURRENT   NAME       CLUSTER            AUTHINFO   NAMESPACE
*         microk8s   microk8s-cluster   admin      

安装后设置

microk8s enable helm3

Kubernetes已启动并正在运行

Kubernetes is up and running

kubectl cluster-info 
Kubernetes master is running at https://127.0.0.1:16443
CoreDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

helm 连接到 microk8s

时出现问题

Problem while connecting helm to microk8s

helm ls --kube-token ~/token --kube-apiserver https://127.0.0.1:16443
Error: Kubernetes cluster unreachable: Get https://127.0.0.1:16443/version?timeout=32s: x509: certificate signed by unknown authority

我怎么知道 helm

  • 信任 microk8s 证书或
  • 忽略此验证步骤

通过阅读,我可以通过使用-kubeconfig 指向kube的配置来克服此问题.

From what I read, I may overcome this issue by pointing to kube's config using --kubeconfig.

helm ls --kube-token ~/token --kube-apiserver https://127.0.0.1:16443 --kubeconfig /path/to/kubernetes/config

在安装了 snap microk8s 的上下文中,我不确定这个 conf文件是什么,也不知道在哪里找到.

In the context of microk8s installed with snap, I am not quite sure what this conf file is nor where to find it.

  • /snap/microk8s/1503 吗?
  • /var/snap/microk8s/1503 吗?

推荐答案

Helm在此路径$ HOME/.kube/config中查找kubeconfig.

Helm looks for kubeconfig at this path $HOME/.kube/config.

请运行此命令

microk8s.kubectl配置视图--raw>$ HOME/.kube/config

microk8s.kubectl config view --raw > $HOME/.kube/config

这会将配置保存在目录中所需的路径上,并且可以正常工作

This will save the config at required path in your directory and shall work

参考链接此处

这篇关于Helm 3:连接到本地Kubernetes时出现x509错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆