k3s执行helm命令报错:Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version?timeout=32s": dial tcp [::1]:8080: connect: connection refused
报错信息:
Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version?timeout=32s": dial tcp [::1]:8080: connect: connection refused
报错原因: helm v3版本不再需要Tiller,而是直接访问ApiServer来与k8s交互,通过环境变量KUBECONFIG来读取存有ApiServre的地址与token的配置文件地址,默认地址为~/.kube/config
解决方法:
手动配置 KUBECONFIG环境变量
-
临时解决:
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml -
永久解决:
- 执行:
vi /etc/profile - 写入内容:
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml - 执行:
source /etc/profile
- 执行:

浙公网安备 33010602011771号