企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 安装kubernetes-dashboard 默认情况下不会部署kubernetes-dashboard ### 下载yaml文件 ~~~ $ wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml ~~~ ### 修改配置 默认Dashboard只能集群内部访问,修改Service为NodePort类型,暴露到外部30001端口 ![](https://img.kancloud.cn/a1/c8/a1c89fd755e8a12542a97e9985f92d19_828x634.png) 手动pull镜像 ~~~ $ docker pull kubernetesui/dashboard:v2.4.0 $ docker pull kubernetesui/metrics-scraper:v1.0.7 $ kubectl apply -f recommended.yaml $ kubectl get pods -n kubernetes-dashboard $ kubectl get pods,svc -n kubernetes-dashboard ~~~ ![](https://img.kancloud.cn/09/b2/09b2855798489aa9b0b09abccf3a48be_1496x656.png) ### 访问kubernetes dashboard 访问:[https://ip:30001](https://ip:30001/) ### 登录 有两种方式登录,使用token或者kubeconfig登录 下面使用token方式登录 创建service account并绑定默认cluster-admin管理员集群角色 ~~~ $ kubectl create serviceaccount dashboard-admin -n kubernetes-dashboard $ kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard-admin $ kubectl describe secrets -n kubernetes-dashboard $(kubectl -n kubernetes-dashboard get secret | awk '/dashboard-admin/{print $1}') ~~~ ![](https://img.kancloud.cn/67/45/67458033729cfba1cf43a9e9ae3b9d48_2368x386.png) 使用输出的token登录即可 ![](https://img.kancloud.cn/e8/74/e874aa9cf3f5f15b4fbd9bb58e45a29e_2778x930.png) 登录成功 ![](https://img.kancloud.cn/4e/09/4e09c637eb7d998681530248767f0b65_2848x1372.png)