Infrastructure worth keeping — and kept patched.

Gradle build cache on Kubernetes: plain manifests, no Helm chart yet

Run a shared build cache in your cluster with plain manifests: one Deployment, one volume, one Service. There is no Helm chart yet. It has not been through a beta on a production cluster, so treat it that way.

Is there a Helm chart?

Not yet. Today the supported way to deploy on Kubernetes is the plain manifests in the Kubernetes guide: a Secret, a volume claim, a Deployment and a Service. Copy them into one file and apply it with kubectl apply -f.

Run exactly one replica

Do not scale this out. The cache keeps its index in a database file that one process holds a lock on. A second pod on the same volume does not share the cache; it waits on the lock or fails to start. Two pods on different volumes give you two half-filled caches.

A cache is safe to lose for a moment. If it is down during a rollout, builds miss the cache and run slower, and nothing breaks. High availability across nodes is a paid-tier idea that is not built, so do not improvise it with two replicas.

Size it in Kubernetes terms

Locked down by default

The manifests run as a non-root user with a read-only root file system, drop all capabilities, forbid privilege escalation, and use the runtime default seccomp profile. There is no privileged mode, no host networking and no host path. They satisfy the Pod Security restricted profile. The volume must be writable by user 65532, which is what the fsGroup setting is for.

Runners in the same cluster

If your CI runners already run in this cluster, including Jenkins agents, GitHub Actions runner controller and GitLab runners, you need no load balancer and no ingress. Point Gradle at the cluster-internal name, for example http://fscache.fscache-ns.svc.cluster.local/, with isAllowInsecureProtocol = true. Gradle requires that for plain http:// addresses. In our test with Gradle 9.8.0, only the literal 127.0.0.1 was let through without it. Here it is reasonable because the traffic never leaves the cluster network. See Jenkins and CI build cache.

Get the manifests

The four manifests (Secret, volume claim, Deployment, Service) and the steps to reach the cache from outside the cluster are in the Kubernetes guide on GitHub. Copy them into one file and apply it.

How we checked

We applied the guide's four manifests to a new kind cluster (Kubernetes in Docker) on a GitHub-hosted Linux machine, with FosterStack Cache 0.2.2. What we saw:

Not tested: a real cloud cluster, other storage classes, a cluster with more than one node, rollouts, the fsGroup requirement, the guide's load balancer, Gateway and Ingress examples, and the cluster-internal name. This was a test on a throwaway cluster, not a production trial. We used the guide at the v0.2.2 tag. The run and its log are public.

Kubernetes guide Gradle and Maven setup