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

How do you cache dependencies with ephemeral Kubernetes agents?

AdvancedConceptPlugins, JCasC & Jenkins on Kubernetes
Answer

Every pod starts empty, so ~/.m2 or node_modules downloads repeat. Options:

  1. A repository manager proxy (Nexus/Artifactory) close to the cluster: the biggest win, and it also protects against upstream outages.
  2. A shared ReadWriteMany PVC mounted at the cache path (watch concurrency and corruption).
  3. Per-node hostPath caches (fast but node-specific and a security concern).
  4. Tool-level remote caches: Gradle build cache, BuildKit/Kaniko registry cache (--cache=true --cache-repo).
All Jenkins questions Roadmap: Jenkins

More on Plugins, JCasC & Jenkins on Kubernetes