Kubernetes operator

Operator RBAC and security

What the operator is allowed to do in your cluster.


RBAC

The operator requires these permissions. They are granted through a ClusterRole by default, or a namespaced Role when operator.watchNamespace scopes the operator to one namespace — the rules themselves are identical either way:

API groupResourceVerbs
pgroles.iopostgrespoliciesget, list, watch, patch, update
pgroles.iopostgrespolicies/statusget, patch, update
pgroles.iopostgrespolicies/finalizersupdate
pgroles.iopostgrespolicyplansget, list, watch, create, update, patch, delete
pgroles.iopostgrespolicyplans/statusget, patch, update
pgroles.ioephemeralaccesspolicies, ephemeralaccessrequestsget, list, watch, patch, update, delete
pgroles.ioephemeralaccesspolicies/status, ephemeralaccessrequests/statusget, patch, update
pgroles.ioephemeralaccesspolicies/finalizers, ephemeralaccessrequests/finalizersupdate
pgroles.ioephemeralaccesspoliciesmanage
""secretsget, list, watch, create, update, patch
""configmapsget, list, create, update, patch, delete
events.k8s.ioeventscreate, patch

postgrespolicyplans is required to apply anything at all, because each apply goes through a plan; configmaps stores plan SQL above the inline size limit. The manage verb is a logical permission with no built-in meaning: admission policy uses it to authorize operator-owned request lifecycle changes without hard-coding a service account identity, which is why the operator holds it while holding neither use nor approve. See securing ephemeral access.

The Helm chart creates the role, its binding, and the ServiceAccount automatically — a ClusterRole and ClusterRoleBinding normally, a Role and RoleBinding in the watched namespace when operator.watchNamespace is set. charts/pgroles-operator/templates/clusterrole.yaml is the source of truth for the rules; check it against this table before hand-writing a role.