Skip to main content
Version: v3.7.1

Role Bindings

A Role Binding links a Role to one or more subjects (users or groups). It defines who gets the permissions defined in the Role. Without a Role Binding, a Role has no effect.

For the YAML spec and a short example, see RoleBinding YAML Specification.

Role Binding structure​

FieldDescription
nameUnique name for the Role Binding.
apiVersionAPI version (e.g. datasance.com/v3).
kindMust be RoleBinding.
roleRefReference to the Role to bind. Required.
subjectsArray of subjects (users or groups) that receive the Role's permissions. Required.

roleRef​

roleRef identifies the Role that this binding grants:

FieldRequiredDescription
kindYesKind of the referenced resource (e.g. Role).
nameYesName of the Role.
apiGroupNoAPI group of the Role.

subjects​

Each subject in subjects identifies a user or group that receives the Role's permissions:

FieldRequiredDescription
kindYesEither User or Group.
nameYesName of the user (Keycloak username) or group (Keycloak controller oidc client role).
apiGroupNoAPI group; can be omitted for core subjects.

Example​

apiVersion: datasance.com/v3
kind: RoleBinding
metadata:
name: developers-binding
roleRef:
kind: Role
name: developer-role
apiGroup: datasance.com/v3
subjects:
- kind: User
name: alice
- kind: Group
name: developers

This binding grants the Role developer-role to the user alice and to all members of the group developers.

Group 3See anything wrong with the document? Help us improve it!