Planted .
Type of object defined by RBAC API.
A Role or ClusterRole contains rules that represent a set of permissions. Permissions are additive, there are no denies.
A Role sets permissions in a specific namespace.
ClusterRole is non-namespace specific.
Example role
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: pod-reader
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["pods"]
verbs: ["get", "watch", "list"]
Example cluster role
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
# "namespace" omitted since ClusterRoles are not namespaced
name: secret-reader
rules:
- apiGroups: [""]
#
# at the HTTP level, the name of the resource for accessing Secret
# objects is "secrets"
resources: ["secrets"]
verbs: ["get", "watch", "list"]
Paths into this note
4 notes lead here
-
To check how many roles exist in a namespace
-
To create a role in Kubernetes, there are two ways.
-
You can check what role a user has/related to RBAC in Kubernetes.
-
A role binding grants the permissions defined in a role to a user or set of users.