RBAC Denied
Error message
forbidden: User cannot <verb> <resource>
Quick summary
RBAC (Role-Based Access Control) rules prevent the user or service account from performing the requested action.
Why this happens
The service account does not have a RoleBinding or ClusterRoleBinding
The Role does not include the required verb (get, list, create, etc.)
The RoleBinding references the wrong service account or namespace
The user is not in the correct group for the ClusterRoleBinding
Minimal example
# Service account has no RoleBinding
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-app# Add Role and RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pod-reader
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: my-app-pod-reader
subjects:
- kind: ServiceAccount
name: my-app
roleRef:
kind: Role
name: pod-readerThe service account has no permissions. The fix creates a Role with pod read permissions and a RoleBinding to grant them.
How to diagnose
Check permissions:
kubectl auth can-i <verb> <resource> --as=<user>List Roles and RoleBindings:
kubectl get roles,rolebindings -n <namespace>Describe the RoleBinding:
kubectl describe rolebinding <name>Check the service account used by the Pod
How to fix
Create or update a Role to include the required permissions
Create or update a RoleBinding to bind the Role to the service account
Fix the RoleBinding to reference the correct service account
Use a ClusterRole/ClusterRoleBinding for cluster-wide permissions
How to prevent
Define RBAC roles for each service account from the start
Use least-privilege principles — only grant the permissions needed
Document required RBAC for each application