Debug and Resolve RBAC Failures for Two Deployments
Two monitoring applications are failing due to missing RBAC permissions. Fix both by creating ServiceAccounts, Roles, and RoleBindings.
Scenario
Your company runs two monitoring applications in the one-piece namespace: monkey-d-luffy for service discovery and crew-monitor for endpoint health monitoring. Both are currently failing due to missing RBAC permissions.
Task
The monkey-d-luffy deployment is trying to list services in the one-piece namespace — specifically test-svc — but the default ServiceAccount does not have permission, resulting in this log error:
Caution
🔍 [monkey-d-luffy] Checking services at 10:15:23...
Error from server (Forbidden): services is forbidden
❌ FAILED: Permission denied
Create proper RBAC configuration:
- Create ServiceAccount
thousand-sunnyin theone-piecenamespace - Create Role
strawhat-rolethat allowsget,list, andwatchoperations onservicesresources - Create RoleBinding
strawhat-rbto bind the Role to the ServiceAccount - Update the
monkey-d-luffydeployment to use thethousand-sunnyServiceAccount
Note
After fixing both, verify the logs show successful operations with ✅ SUCCESS messages.
Hint
kubectl create serviceaccount <n> -n one-piece- Role needs: apiGroups: "", resources: "services" or "endpoints", verbs: "get", "list", "watch"
kubectl create rolebinding <n> --role=<role> --serviceaccount=one-piece:<sa> -n one-piece- Update deployment SA:
kubectl set serviceaccount deployment <n> <sa> -n one-piece