Kubernetes example
In this example you’ll deploy NativeLink to a local Kubernetes cluster using Helm and run Bazel builds against it.
Requirements
- A local Kubernetes cluster. Either:
- Docker Desktop with Kubernetes enabled (Settings > Kubernetes > Enable Kubernetes), or
- minikube
- Helm 3
- kubectl
- Bazel (to run builds against the cluster)
Pull the Helm chart from the NativeLink OCI registry and install it:
helm install nativelink \ oci://public.ecr.aws/b1l4l6w7/tracemachina/nativelink \ --version 1.0.0-rc1 \ -n nativelink \ --create-namespaceWait for the pods to become ready:
kubectl get pods -n nativelink -wYou should see pods for the CAS, scheduler, and worker components:
NAME READY STATUS RESTARTS AGEnativelink-cas-... 1/1 Running 0 60snativelink-scheduler-... 1/1 Running 0 60snativelink-worker-... 1/1 Running 0 60sView logs for individual components:
# CAS (Content Addressable Storage) logskubectl logs deploy/nativelink-cas -n nativelink
# Scheduler logskubectl logs deploy/nativelink-scheduler -n nativelink
# Worker logskubectl logs deploy/nativelink-worker -n nativelinkPort-forward the NativeLink services to your local machine:
# In a separate terminal — keep this runningkubectl port-forward svc/nativelink-cas 50051:50051 -n nativelink &kubectl port-forward svc/nativelink-scheduler 50052:50052 -n nativelink &Now run a Bazel build against the cluster:
bazel build \ --remote_cache=grpc://localhost:50051 \ --remote_executor=grpc://localhost:50052 \ //...The key output to look for:
INFO: 11 processes: 9 internal, 2 remote.This tells you the build ran against the cluster. Clean the local cache and rebuild to verify caching works:
bazel clean && bazel build \ --remote_cache=grpc://localhost:50051 \ --remote_executor=grpc://localhost:50052 \ //...You should now see cache hits:
INFO: 11 processes: 2 remote cache hit, 9 internal.To customize the Helm chart values, first extract the default values:
helm show values \ oci://public.ecr.aws/b1l4l6w7/tracemachina/nativelink \ --version 1.0.0-rc1 > nativelink-values.yamlEdit nativelink-values.yaml to your needs, then upgrade the release:
helm upgrade nativelink \ oci://public.ecr.aws/b1l4l6w7/tracemachina/nativelink \ --version 1.0.0-rc1 \ -n nativelink \ -f nativelink-values.yamlSee the Helm chart documentation for details on configuring cloud object stores (S3, GCS, Azure Blob), Redis, ingress, metrics, and more.
When you’re done testing, remove the NativeLink deployment:
helm uninstall nativelink -n nativelinkkubectl delete namespace nativelink