How do Kubernetes agent pods get permissions to deploy?
IntermediateConceptPlugins, JCasC & Jenkins on Kubernetes
Answer
Set serviceAccountName in the deploy pod template and bind that service account with a RoleBinding in the target namespaces. kubectl in the pod uses the mounted token automatically. Use a separate service account per environment (deployer-dev, deployer-prod) and only use the prod template in stages gated by when { branch 'main' } and input. For cloud APIs use workload identity (IRSA, EKS Pod Identity, GKE Workload Identity) instead of static keys.
More on Plugins, JCasC & Jenkins on Kubernetes
How do you manage plugins in a reproducible way?IntermediateWhat does `jenkins-plugin-cli` resolve for you, and what flags matter?IntermediateWhy should you keep the number of plugins low?BeginnerWhat is JCasC and how is it loaded?BeginnerWhat are the top-level root elements in a JCasC file?IntermediateHow do you inject secrets into JCasC without committing them?Advanced