kubernetes:以管理员身份登录仪表板

时间:2018-01-09 14:40:34

标签: kubernetes kubernetes-security

我已使用''' <summary> ''' Any Text ''' </summary> k8s群集部署到aws

该过程创建了一个kops文件,其结构如下:

~./kube/config

当(创建仪表板后)我执行apiVersion: v1 clusters: - cluster: certificate-authority-data: <data_here> name: <cluster_name> contexts: - context: cluster: <cluster_name> user: <cluster_name> name: <cluster_name>l current-context: <cluster_name> kind: Config preferences: {} users: - name: <cluster_name> user: as-user-extra: {} client-certificate-data: <client_certificate_data> client-key-data: <client-key-data> password: <some-password> username: admin - name:<cluster-name>-basic-auth user: as-user-extra: {} password: <some-password> username: admin 并尝试通过localhost访问它时,我会看到以下屏幕提示:

enter image description here

1 :为什么当我将文件浏览器指向上面创建的kube proxy文件时

  

身份验证失败

2 :当我提供~./kube/config文件中包含的password时,我确实登录但不是管理员(例如我无法查看计算资源)豆荚)

1 个答案:

答案 0 :(得分:1)

您可以通过运行此yaml文件来授予管理员权限:

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: dashboard
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: kubernetes-dashboard
  namespace: kube-system

这将允许访问kubernetes仪表板。但这将提供开放访问权限,您需要在运行此操作后跳过登录。 更多细节可以在https://github.com/kubernetes/dashboard/wiki/Access-control

找到