How do you deploy to Kubernetes from Jenkins?
IntermediateConceptIntegrations: SonarQube, Nexus, Artifactory, Docker, Trivy
Answer
Common options:
kubectl/helmin a deploy pod whose service account has a RoleBinding in the target namespace.kubectlwith a kubeconfig stored as a Secret file credential (withCredentials([file(credentialsId: 'kubeconfig-dev', variable: 'KUBECONFIG')])) for external clusters.- GitOps: Jenkins updates the image tag in a config repo and Argo CD or Flux applies it. This removes cluster credentials from Jenkins entirely, which is what we prefer for production.
Always follow kubectl apply with kubectl rollout status --timeout so the build fails when the rollout fails.
More on Integrations: SonarQube, Nexus, Artifactory, Docker, Trivy
How do you integrate SonarQube with a Jenkins pipeline?IntermediateHow does `waitForQualityGate` work?IntermediateHow do you deploy Maven artifacts to Nexus from Jenkins?IntermediateHow do you publish npm packages or pull dependencies through Nexus or Artifactory?BeginnerHow do you use JFrog Artifactory from Jenkins?IntermediateHow do you build and push a Docker image from Jenkins on a VM agent?Beginner