How do you build a safe Jenkins deployment pipeline for Kubernetes?
IntermediateProductionJenkins in Production
Answer
Build the image with a rootless builder, scan with Trivy, push by SHA, then deploy using helm upgrade --install --atomic --timeout 5m so a failed rollout auto-rolls back. Credentials come from a restricted service account (short-lived token or IRSA via the agent's pod identity), deploy happens on a dedicated agent label, and a post-deploy kubectl rollout status plus smoke test verifies. Lock the environment, and notify on completion.
sh '''
helm upgrade --install shop-api ./chart \
--namespace shop --create-namespace \
--set image.tag=$GIT_COMMIT \
--atomic --timeout 5m
'''
More on Jenkins in Production
How do you run Jenkins for high availability and scale?AdvancedHow do you tune the Jenkins controller JVM and avoid out-of-memory crashes?AdvancedHow do you back up and restore Jenkins?IntermediateHow do you upgrade Jenkins and its plugins safely?IntermediateHow do you harden a Jenkins controller?AdvancedHow do you configure dynamic Kubernetes agents in Jenkins for production use?Intermediate