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:
- A repository manager proxy (Nexus/Artifactory) close to the cluster: the biggest win, and it also protects against upstream outages.
- A shared ReadWriteMany PVC mounted at the cache path (watch concurrency and corruption).
- Per-node
hostPathcaches (fast but node-specific and a security concern). - Tool-level remote caches: Gradle build cache, BuildKit/Kaniko registry cache (
--cache=true --cache-repo).
More on Plugins, JCasC & Jenkins on Kubernetes
How do you manage plugins in a reproducible way?IntermediateWhat does `jenkins-plugin-cli` resolve for you, and what flags matter?IntermediateWhy should you keep the number of plugins low?BeginnerWhat is JCasC and how is it loaded?BeginnerWhat are the top-level root elements in a JCasC file?IntermediateHow do you inject secrets into JCasC without committing them?Advanced