我是K8s的完美 noob 。我安装了microk8sHelm,并使用snap在本地进行了实验。我想知道我当前的问题是否来自snap的使用(据我了解,其用途是封装)
环境
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已启动并正在运行
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时出现问题
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的配置来克服此问题。
    helm ls --kube-token ~/token --kube-apiserver https://127.0.0.1:16443 --kubeconfig /path/to/kubernetes/config
    
    在安装了microk8ssnap的上下文中,我不太确定此conf文件是什么,也不知道在哪里找到它。
  • /snap/microk8s/1503吗?
  • /var/snap/microk8s/1503吗?
  • 最佳答案

    Helm在此路径$ HOME/.kube/config中查找kubeconfig。
    请运行此命令

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

    关于kubernetes - Helm 3 : x509 error when connecting to local Kubernetes,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/63050980/

    10-11 07:16