1.Kubernetes Dashboard
Dashboard 是基于网页的 Kubernetes 用户界面。 你可以使用 Dashboard 将容器应用部署到 Kubernetes 集群中,也可以对容器应用排错,还能管理集群资源。 你可以使用 Dashboard 获取运行在集群中的应用的概览信息,也可以创建或者修改 Kubernetes 资源 (如 Deployment,Job,DaemonSet 等等)。 例如,你可以对 Deployment 实现弹性伸缩、发起滚动升级、重启 Pod 或者使用向导创建新的应用。
Dashboard 同时展示了 Kubernetes 集群中的资源状态信息和所有报错信息。
2.安装
默认情况下不会部署 Dashboard。可以通过以下命令部署:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
2.1 The connection to the server raw.githubusercontent.com was refused - did you specify the right host or port?
使用https://www.ipaddress.com/查询raw.githubusercontent.com的IP,设置host文件
#sudo vim /etc/hosts
199.232.96.133 raw.githubusercontent.com
#kubectl edit cm kube-proxy -n kube-system
在配置文件中
发现mode项目,我目前的配置是mode:“”,修改为mode: "ipvs"
#kubectl get pod -n kube-system | grep kube-proxy | awk '{system("kubectl delete pod "$1" -n kube-system")
运行
#kubectl proxy
访问
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
3.访问Kubernetes Dashboard
启动成功后我们会看到下图界面
在控制台运行,复制生成的token到输入框就能登录.
#kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
引用:1.https://kubernetes.io/zh/docs/tasks/access-application-cluster/web-ui-dashboard/