kubenetes github :https://github.com/kubernetes/dashboard/releases

kubenetes官网:https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
Kubernetes 1.6 配置可视化界面_第1张图片
这是官网的截图,但是我去下载发现不成功
其实真正的地址在
https://github.com/kubernetes/dashboard/blob/master/aio/deploy/recommended.yaml

所以kubenetes v1.16.0 应该使用新版dashboard ui才兼容

 

查看github,用到的镜像有两个dashboard:v2.0.0-beta4、metrics-scraper:v1.0.1

kubernetesui/dashboard:v2.0.0-beta4
kubernetesui/metrics-scraper:v1.0.1

先拉取镜像,本人使用的docker版本19.03.2

docker pull kubernetesui/dashboard:v2.0.0-beta4
docker pull kubernetesui/metrics-scraper:v1.0.1

主节点从节点都需要拉镜像
拉成功后

获取yaml文件

https://github.com/kubernetes/dashboard/blob/master/aio/deploy/recommended.yaml```

修改recommended.yaml文件,为了方便访问,修改kubernetes-dashboard的Service定义,指定Service的type类型为NodeType,指定nodePort端口
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
type: NodePort # 改成NodePort
ports:

  • port: 443
    targetPort: 8443
    nodePort: 31001 # 指定nodePort端口
    selector:
    k8s-app: kubernetes-dashboard
    修改完后

    kubectl apply -f recommended.yaml```

运行结果如图所示:

Kubernetes 1.6 配置可视化界面_第2张图片
查看是否启动

kubectl get pods -n kubernetes-dashboard -o wide```
![](https://s4.51cto.com/images/blog/202007/07/694dfd9501194038bb69bbad87aeea1a.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

获取查看token

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')


![](https://s4.51cto.com/images/blog/202007/07/197a187374e45718eb9546fb12b597b7.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
访问https: 31001
输入token
![](https://s4.51cto.com/images/blog/202007/07/367e2f84336b7557bf8cb285b14071c4.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)