Interview Prep/Jenkins/Integrations: SonarQube, Nexus, Artifactory, Docker, Trivy

How do you deploy to Kubernetes from Jenkins?

IntermediateConceptIntegrations: SonarQube, Nexus, Artifactory, Docker, Trivy
Answer

Common options:

  • kubectl/helm in a deploy pod whose service account has a RoleBinding in the target namespace.
  • kubectl with 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.

All Jenkins questions Roadmap: Jenkins

More on Integrations: SonarQube, Nexus, Artifactory, Docker, Trivy