# cat role.yaml
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: test-user-role
namespace: test-user-ns # Should be namespace you are granting access to
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: test-user-rolebinding
namespace: test-user-ns # Should be namespace you are granting access to
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: test-user-role # Should match name of Role
subjects:
- namespace: test-user-ns
kind: ServiceAccount
name: test-user # Should match service account name, above
# kubectl create -f ./role.yaml
role.rbac.authorization.k8s.io/test-user-role created
rolebinding.rbac.authorization.k8s.io/test-user-rolebinding created