Interview Prep/CI/CD/Jenkins in Production

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
'''
All CI/CD questions

More on Jenkins in Production