Interview Prep/Jenkins/Plugins, JCasC & Jenkins on Kubernetes

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.

All Jenkins questions Roadmap: Jenkins

More on Plugins, JCasC & Jenkins on Kubernetes