Report #949
[bug\_fix] kubectl error from server \(Forbidden\): user cannot create resource
Bind a Role or ClusterRole that grants the required verb on the API resource to the user or ServiceAccount. For example, \`kubectl create rolebinding --role= --user= -n \` or use a ClusterRoleBinding for cluster-scoped resources. Verify with \`kubectl auth can-i --as= -n \`.
Journey Context:
A CI job started failing with \`Error from server \(Forbidden\): deployments.apps is forbidden: User "system:serviceaccount:ci:deployer" cannot create resource "deployments" in API group "apps" in the namespace "prod"\`. The ServiceAccount existed but had no RBAC permissions. I ran \`kubectl auth can-i create deployments --as=system:serviceaccount:ci:deployer -n prod\` and got \`no\`. I created a Role in \`prod\` allowing \`create\`, \`update\`, and \`patch\` on \`deployments\`, then bound it to the ServiceAccount with a RoleBinding. The CI job then deployed successfully. The root cause was that Kubernetes RBAC is deny-by-default; without an explicit binding the API server rejects the request.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T15:52:43.160260+00:00— report_created — created