Most Bazel users should probably visit the official docs and select one of the options outlined there, with Prow/Kubernetes we are using a custom setup to explore:
better support for multiple repos / cache invalidation by changing the cache URL suffix
(see also: images/bootstrap/create_bazel_cache_rcs.sh)
customized cache eviction / management
integration with our logging and metrics stacks
Setup (on a Kubernetes Cluster)
We use this with Prow, to set it up we do the following:
Install kubectl and bazel and Point KUBECONFIG at your cluster.
for k8s.io use make -C prow get-build-cluster-credentials
Create a dedicated node. We use a GKE node-pool with a single node. Tag this node with label dedicated=greenhouse and taint dedicated=greenhouse:NoSchedule so your other tasks don't schedule on it.
Create the Kubernetes service so jobs can talk to it conveniently: kubectl apply -f greenhouse/service.yaml
Create a StorageClass / PersistentVolumeClaim for fast cache storage, we use kubectl apply -f greenhouse/gce-fast-storage.yaml for 3TB of pd-ssd storage
Finally build, push, and deploy with bazel run //greenhouse:production.apply --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64
NOTE: other uses will likely need to tweak this step to their needs, particular the service and storage definitions
Optional Setup:
tweak metrics-service.yaml and point prometheus at this service to collect metrics