Loading... # 要求 Kubernetes 集群 v1.15+ helm 3.1.0+ # 一 安装 Kubeapps 使用 Helm chart 安装最新版本的 Kubeapps: ``` helm repo add bitnami https://charts.bitnami.com/bitnami kubectl create namespace kubeapps helm install kubeapps --namespace kubeapps bitnami/kubeapps ``` # 二 创建用于访问 Kubeapps 和 Kubernetes 的凭证 ``` kubectl create --namespace default serviceaccount kubeapps-operator kubectl create clusterrolebinding kubeapps-operator --clusterrole=cluster-admin --serviceaccount=default:kubeapps-operator ``` > 注意不建议为用户在生产环境分配`cluster-admin` 角色 获取检索令牌 ``` kubectl get secret $(kubectl get serviceaccount kubeapps-operator -o jsonpath='{range .secrets[*]}{.name}{"\n"}{end}' | grep kubeapps-operator-token) -o jsonpath='{.data.token}' -o go-template='{{.data.token | base64decode}}' && echo ``` # 修改访问模式并访问kubeapps 编辑kubeapps服务svc 将连接类型改为NodePort ``` kubectl edit svc kubeapps -n kubeapps ``` ![](https://www.truenasscale.com/usr/uploads/2022/04/1073038038.png) 查看nodeport ![](https://www.truenasscale.com/usr/uploads/2022/04/1503507652.png) 浏览器输入`http://IP:PORT`就可以访问了,然后输入获取的token # 报错解决 报错信息: ``` 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 ``` 最后修改:2022 年 04 月 18 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 感谢您的支持