Interview Prep/Jenkins/Plugins, JCasC & Kubernetes agents

Kubernetes plugin: `Failure executing: POST at: https://10.96.0.1/api/v1/namespaces/jenkins-agents/pods. Message: pods is forbidden: User "system:serviceaccount:jenkins:jenkins" cannot create resource "pods" in API group "" in the namespace "jenkins-agents".`

BeginnerTroubleshootingPlugins, JCasC & Kubernetes agents
Answer

Likely causes → Missing Role/RoleBinding for the controller's service account in the agent namespace.

Diagnose →

kubectl auth can-i create pods -n jenkins-agents --as system:serviceaccount:jenkins:jenkins

Fix → Create a Role with pods, pods/exec, pods/log, events permissions in jenkins-agents and bind it to jenkins:jenkins.

Prevent → RBAC in the same Helm chart/manifests as the controller.

All Jenkins questions Roadmap: Jenkins

More on Plugins, JCasC & Kubernetes agents