kubernetes原生dashboard部署

获取部署的yaml文件:

https://raw.githubusercontent.com/kubernetes/dashboard/v1.8.3/src/deploy/recommended/kubernetes-dashboard.yaml

修改yaml文件:

1.deployment:

        image: daocloud.io/liukuan73/kubernetes-dashboard-amd64:v1.8.3
        imagePullPolicy: IfNotPresent
...
      nodeSelector:
        node-role.kubernetes.io/master: true
      # Comment the following tolerations if Dashboard must not be deployed on master
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule

2.service:

    type: NodePort
      nodePort: 30001

3.把Role和RoleBinding注释掉。

我修改后的yaml文件请见:https://github.com/liukuan73/kubernetes-addons/blob/master/dashboard/kubernetes-dashboard.yaml

登录界面

说明:
kubernetes1.7.0+之后dashboard的登录url改了,详情请见:https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard—1.7.X-and-above

  • 通过其暴露nodeport的方式登录:https://10.142.21.21:30001
    可以通过输入token登录:
kubectl get secret -n kube-system | grep dashboard  
kubectl describe secret kubernetes-dashboard-token-xtxc4 -n kube-system         

输入获取到的这个token登录:
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJlcm5ldGVzLWRhc2hib2FyZC10b2tlbi14dHhjNCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjljNTJhYzg1LTZjYmUtMTFlOC1iZWNiLTAwNTA1Njk0ZWI2YSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTprdWJlcm5ldGVzLWRhc2hib2FyZCJ9.hup623KovQYD47bnCyB76jsZp1KwugbQLNINucrubvYXDK5KVsAhLu36SQls4bid-Zt5n5wRI6T5o4YrgCzmyngQu9Y_gMwdOWawEfJgorTp_YvK6227SG-0CQUYWeo7kqyJAXhWWax8vbxbBTvY4vDCO1RsxPNmQf5OiU8dzpQseIXVcWp-Xrj3WZK6eMsxQJs0DKVbw6V4Xcp8mAqe53RY1FHhVCyzExMMy5QtaPo1wav3XmrM24yM8EgSOYKWT-JBkBQaazH_2SU_GlvS_cqe9b_WMLG2TirhSD5vKhuPlfM3OESrfQao8vPTgBKG5iMWg2LZcA_ZPu7LgDhQdQ
  • 通过apiserver代理登录
    https://10.142.21.21:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
    使用/etc/kubernetes/users/known_users.csv中的用户名密码登录apiserver
    备注:
    打开dashboard后一些监控指需要部署好heapster之后才能显示出来。

参考:

https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/

你可能感兴趣的:(kubernetes)