Warm tip: This article is reproduced from serverfault.com, please click

Allow everyone in RoleBinding for a namespace

发布于 2020-11-30 09:24:58

I am trying to create a public namespace public-ns which should be accessible for all the users and groups. I have defined RoleBinding as following which allows 2 group and 2 users to access the namespace.

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: allow-everyone
  namespace: public-ns
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: pods-services
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: User
  name: user-one
- apiGroup: rbac.authorization.k8s.io
  kind: User
  name: user-two
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: group-one
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: group-two

Now, I want to allow the access to this namespace for all the groups. I have tried giving '*' and any as following it did not work.

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: allow-everyone
  namespace: public-ns
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: pods-services
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: any  ## tried '*' as well

Can anyone please suggest me how can I give permissions for everyone for this specific namespace. If this is not possible any alternatives suggested would be great.

Note: OIDC enabled on K8s with Keycloak.

Thanks in advance.

Questioner
Pradeep Kumar
Viewed
0
Jxadro 2020-11-30 17:44:49