kubernetes cluster-admin 无法创建 CRD?
我正在尝试创建可以创建 CRD 的服务帐户,但是当我将服务帐户绑定到 cluster-admin 时,kubernetes 告诉我它没有权限,
这就是我绑定它的方式
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: my-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: my-user
namespace: my-namespace
,并且我已经创建了服务帐户使用:
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-user
namespace: my-namespace
但是当我运行 kubectl auth can-i create CustomResourceDefinition --as=my-user --all-namespaces 时,它返回 no 。
我不明白它如何不允许创建 CRD
I am attempting to create service account that can create a CRD, but when I bind the service account to cluster-admin, kubernetes is telling me that it doesn't have permission
this is how I bind it
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: my-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: my-user
namespace: my-namespace
and I've created the service account using:
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-user
namespace: my-namespace
but when I run kubectl auth can-i create CustomResourceDefinition --as=my-user --all-namespaces
it returns no
.
I'm failing to see how it does not permission to create CRD's
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,您不能仅在 --as 标志中指定服务帐户的名称。
运行 $ kubectl auth can-i create customresourcedefinition --as=system:serviceaccount:my-namespace:my-user 返回
yes
我还试图限制 CRD允许使用
reosurceName
字段创建服务帐户,但显然,您需要访问get, create
所有 CRD 才能创建 CRD,即使您拥有所有 CRD具有特定resourceName
的 CRD 的权限Turns out you cannot specify just the name of the service account in the --as flag.
running
$ kubectl auth can-i create customresourcedefinition --as=system:serviceaccount:my-namespace:my-user
returnsyes
I was also trying to limit the CRD that the service account was allowed to create by using the
reosurceName
field, but apparently, you need access toget, create
all CRD's in order to create a CRD even if you have all the permissions for the CRD with a specificresourceName