美文网首页
Kubernetes Web UI (Dashboard)

Kubernetes Web UI (Dashboard)

作者: 香菜香菜我是折耳根 | 来源:发表于2020-02-17 12:07 被阅读0次
    kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
    

    在登录 Kubernetes Web UI 之前,需要创建得到认证和授权的账号。

    首先创建 serviceaccount.yaml

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: admin-user
      namespace: kubernetes-dashboard
    
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: admin-user
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: cluster-admin
    subjects:
    - kind: ServiceAccount
      name: admin-user
      namespace: kubernetes-dashboard
    
    kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
    
    Name:         admin-user-token-vdll9
    Namespace:    kubernetes-dashboard
    Labels:       <none>
    Annotations:  kubernetes.io/service-account.name: admin-user
                  kubernetes.io/service-account.uid: d44f0722-23fa-43ca-b348-0c9d761490e4
    
    Type:  kubernetes.io/service-account-token
    
    Data
    ====
    ca.crt:     1025 bytes
    namespace:  20 bytes
    token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLXZkbGw5Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJkNDRmMDcyMi0yM2ZhLTQzY2EtYjM0OC0wYzlkNzYxNDkwZTQiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6YWRtaW4tdXNlciJ9.PQTkzmdCLxqbJXbkDQkpiNsZiDWDKASaX2AyiEGRFn1tIMKmxryGVT5dU83h1BWieuUubtbc7cJScq1KR3uvJ9K5L0rIp_SuRNygm_b2NMeOkZVoBz7VlX89YSw8ovyqYBvziA01BgBRLfVa0S1L-Z8GEcTW7bmCsW4f2gBg3fUgj5PCqhaLrMC4W8o2jKv9nlJDW5OKuBYNmTmc7Sq0klfwbOD8XFwUkim_4chKg1OkQz8J6os7ymrmIPVZxJkNnnihpzP62yehMBk-UTvJYrOEQEJBmYyzTtRuXgpP4grTrlGH2Fie037MQZ6bguLFcnuq5huUhhKh4vvjw-9XYA
    

    执行 kubectl proxy,访问 http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ ,选择 Token 登录方式,填入上面的 token 字段值。

    相关文章

      网友评论

          本文标题:Kubernetes Web UI (Dashboard)

          本文链接:https://www.haomeiwen.com/subject/wflbfhtx.html