简体   繁体   English

默认用户的Kubernetes RBAC身份验证

[英]Kubernetes RBAC authentication for default user

I am using kops in AWS to create my Kubernetes cluster. 我正在AWS中使用kops创建我的Kubernetes集群。

I have created a cluster with RBAC enabled via --authorization=RBAC as described here. 我已经创建了一个群集,该群集通过--authorization=RBAC启用了--authorization=RBAC ,如此处所述

I am trying to use the default service account token to interact with the cluster and getting this error: 我试图使用默认的服务帐户令牌与群集进行交互,并收到此错误:

Error from server (Forbidden): User "system:serviceaccount:default:default" cannot list pods in the namespace "default". (get pods)

Am I missing a role or binding somewhere? 我是否缺少角色或在某处绑定?

I thing it is not a good idea to give the cluster-admin role to default service account in default namespace . 将cluster-admin角色赋予默认名称空间中的默认服务帐户 不是一个好主意

If you will give cluster-admin access to default user in default namespace - every app (pod) that will be deployed in cluster, in default namespace - will be able to manipulate the cluster (delete system pods/deployments or make other bad stuff) . 如果您要授予群集管理员对默​​认名称空间中的默认用户的访问权限- 在默认名称空间中部署在群集中的每个应用程序(pod) - 都可以操纵群集(删除系统Pod /部署或进行其他不良处理)

By default the clusterrole cluster-admin is given to default service account in kube-system namespace. 默认情况下,将clusterrole cluster-admin分配给kube-system名称空间中的默认服务帐户。 You can use it for interacting with cluster. 您可以使用它与集群进行交互。

尝试赋予管理员角色,然后尝试。

kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin  --serviceaccount=default:default

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM