rajsinghtech/garage-operator
About
A Kubernetes operator for managing Garage - a distributed S3-compatible object storage system designed for self-hosting.
Systems & InfrastructureMeasured star growth
- in 24h
- +1
- in 7 days
- +3
- in 15 days
- +7
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalGarage Kubernetes Operator
S3-Compatible Object Storage on Kubernetes
Read the operator documentation · Releases · Support
A Kubernetes operator for Garage, the self-hosted, distributed S3-compatible object store. You describe clusters, buckets and keys as Kubernetes resources, and the operator builds and maintains the Garage cluster behind them.
- Manages the StatefulSets, config and Garage layout for a cluster from one
GarageClusterresource. - Runs storage pods and gateway pods in the same cluster. Gateways keep a persistent Garage node identity across restarts.
- Pins Garage nodes to specific Kubernetes Nodes and HostPath disks (node-local pools), including several disks per node.
- Creates buckets, quotas and S3 credentials with
kubectl. - Joins Garage clusters in different Kubernetes clusters into one federated cluster.
- Supports
kubectl scaleand autoscalers for the default storage group. - Includes an optional COSI driver.
Custom resources
| Resource | What it does |
|---|---|
GarageCluster |
Deploys and manages a Garage cluster (storage tier, gateway tier, or both) |
GarageBucket |
Creates a bucket, with quotas, aliases, lifecycle rules and website hosting |
GarageKey |
Creates an S3 access key with per-bucket permissions |
GarageNode |
Controls one node's layout role (zone, capacity, tags) |
GarageAdminToken |
Creates a static admin token in a Secret in its own namespace |
GarageReferenceGrant |
Lets resources in one namespace use clusters, buckets and keys in another |
GarageReplication |
Copies objects between two independent clusters. Off by default (enable it with the chart value replication.enabled) |
Install
You need Kubernetes 1.25 or newer (1.27 or newer for node-local pools, which rely on Pod scheduling gates), Helm 3.8 or newer, and cert-manager.
The chart turns on the admission and conversion webhooks by default, and they need cert-manager's certificates. Install cert-manager first, then the operator:
helm install garage-operator oci://ghcr.io/rajsinghtech/charts/garage-operator \
--namespace garage-operator-system \
--create-namespace
Setting --set webhooks.enabled=false skips cert-manager, but it removes the admission safety checks and v1beta1 conversion. Use it only for local development or simple v1beta2 installs on EmptyDir. Node-local pools and operator-managed PVCs don't work without webhooks. See Installation for the details, namespace-scoped installs and raw manifests.
Verifying release artifacts
Release images and Helm charts are signed with cosign using keyless signing from GitHub Actions, so there are no long-lived keys. They also carry SLSA build provenance, and the image has an SPDX SBOM. All of these are stored in GHCR next to the artifact.
IMAGE=ghcr.io/rajsinghtech/garage-operator:v0.9.6
# Signature
cosign verify "$IMAGE" \
--certificate-identity-regexp '^https://github.com/rajsinghtech/garage-operator/\.github/workflows/docker\.yml@refs/' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
# Provenance and SBOM
gh attestation verify "oci://$IMAGE" --repo rajsinghtech/garage-operator
cosign download attestation "$IMAGE" --predicate-type https://spdx.dev/Document/v2.3
The chart is signed the same way, with a certificate identity ending in helm\.yml@refs/. The install.yaml attached to each release has a provenance attestation too: gh attestation verify install.yaml --repo rajsinghtech/garage-operator.
If you use a policy controller, pin images by digest and require the signature. With Kyverno, that means verifyImages with keyless.issuer: https://token.actions.githubusercontent.com and the subject regexp above. Installation also covers verifying the chart by digest.
Garage version compatibility
You choose the Garage version with GarageCluster.spec.image, GarageNode.spec.image or the chart's defaultGarageImage. The chart's appVersion is the operator's version, not Garage's.
Garage v2.0.0 or newer is required. The operator talks only to the /v2 Admin API, which first shipped in v2.0.0. Against Garage 0.x or 1.x every admin call returns 404 and no cluster reconciles. Garage v3 is not supported yet either.
When spec.image is unset, the operator uses dxflrs/garage:v2.6.0@sha256:4b5a318fc9fe2fbec5d3af590eeafe05d83492e6411266fa0b9e215c20264013. That is the version most of CI runs against. CI also runs the core bucket and key path on v2.4.1 and v2.0.0, and nightly on Garage's main-v2 branch. Other v2 releases should work, because the Admin API is the same, but they aren't tested one by one. The compatibility matrix has the full list, including Garage releases with known problems.
A few fields need a newer Garage than v2.0.0:
| Field | Needs | On older Garage |
|---|---|---|
GarageBucket.spec.lifecycle |
v2.3.0 | Garage accepts the write and drops the field. The operator reads the rules back and sets LifecycleConfigured=False. The bucket still reconciles. |
GarageCluster.spec.database.engine: fjall |
v2.1.0 | Garage v2.0.x refuses to start (Invalid DB engine). |
GarageCluster.spec.database.fjallBlockCacheSize |
v2.1.0 | Ignored. |
GarageCluster.spec.blocks.maxConcurrentReads |
v2.1.0 | Ignored. |
GarageCluster.spec.blocks.maxConcurrentWritesPerRequest |
v2.2.0 | Ignored. |
Garage ignores config keys it doesn't know, so a field that's too new is a no-op, not a crashloop. The operator only writes a key when you set the matching field.
To see which Garage version a cluster is running:
kubectl get garagecluster garage -o jsonpath='{.status.buildInfo.version}'
API versions
GarageCluster is served as two versions. Every other resource is v1beta1.
| Version | Status | Shape |
|---|---|---|
garage.rajsingh.info/v1beta2 |
Current, and the storage version | Tiers: spec.storage and/or spec.gateway |
garage.rajsingh.info/v1beta1 |
Deprecated, still served | Flat: spec.replicas, spec.gateway: bool |
A conversion webhook translates in both directions, so existing v1beta1 manifests keep working. Write new clusters as v1beta2.
The v1beta1 view of a cluster is lossy in two cases, so use v1beta2 for these:
- A cluster with both
storageandgatewayhas no v1beta1 equivalent. Read as v1beta1, it shows only the storage tier. spec.storage.nodeLocalPoolsexists only in v1beta2. A v1beta1 read and write round trip preserves it, but v1beta1 clients can't edit it.
kubectl scale works on a cluster with an Auto-managed default storage group. It changes .spec.storage.replicas on v1beta2 and .spec.replicas on v1beta1. Manual shapes and gateway-only v1beta2 clusters have no scalable group. API versions has the details and the planned deprecations.
Quick start
Create the admin token that the operator uses to talk to Garage:
kubectl create secret generic garage-admin-token \
--from-literal=admin-token=$(openssl rand -hex 32)
Create a cluster with 3 storage pods and 2 gateway pods (full example):
apiVersion: garage.rajsingh.info/v1beta2
kind: GarageCluster
metadata:
name: garage
spec:
zone: us-east-1
replication:
factor: 3
storage:
replicas: 3
metadata:
size: 10Gi
data:
size: 100Gi
gateway:
replicas: 2
network:
rpcBindPort: 3901
service:
type: ClusterIP
admin:
adminTokenSecretRef:
name: garage-admin-token
key: admin-token
Leave out spec.gateway for a storage-only cluster. Wait for it to become ready:
kubectl wait --for=condition=Ready garagecluster/garage --timeout=300s
Create a bucket and a key with read and write access to it:
apiVersion: garage.rajsingh.info/v1beta1
kind: GarageBucket
metadata:
name: my-bucket
spec:
clusterRef:
name: garage
quotas:
maxSize: 10Gi
---
apiVersion: garage.rajsingh.info/v1beta1
kind: GarageKey
metadata:
name: my-key
spec:
clusterRef:
name: garage
bucketPermissions:
- bucketRef:
name: my-bucket
read: true
write: true
The operator writes the credentials to a Secret named after the key:
kubectl get secret my-key -o jsonpath='{.data.access-key-id}' | base64 -d && echo
kubectl get secret my-key -o jsonpath='{.data.secret-access-key}' | base64 -d && echo
kubectl get secret my-key -o jsonpath='{.data.endpoint}' | base64 -d && echo
The Secret holds access-key-id, secret-access-key, endpoint, host, scheme and region. To rename those keys, leave some out, or add an AWS credentials file, see Buckets and credentials. That page also covers allBuckets (access to every bucket in the cluster) and importing existing keys.
Documentation
The full documentation is at rajsinghtech.github.io/garage-operator. It's built from docs/. Where to look:
| Topic | Page |
|---|---|
| Install, first cluster, picking a topology | Installation, Quickstart, Topologies |
| Storage identity, layout, API versions | Storage identity and layout, API versions |
| Buckets, keys, website hosting, lifecycle rules, cross-namespace access | Buckets and credentials, GarageReferenceGrant |
Gateways, manual nodes, multi-disk storage, failure domains (zoneFrom) |
Gateways, Manual nodes, Configure Garage, Storage identity and layout |
| Node-local pools | Node-local pools |
| Federation and replication between clusters | Federate clusters, Replicate between clusters |
| Monitoring, alerts, Grafana dashboard | Monitor Garage |
| CSI-S3 and COSI | Use CSI-S3 and COSI |
| Scaling, repairs, replication factor changes, annotations, deletion and recovery | Day-2 operations, Maintenance and recovery, Annotations and conditions |
| Upgrades and troubleshooting | Upgrades, Troubleshooting |
Other places:
- Contributing: development, testing and release workflow
- Design records: designs for substantial or risky changes
- Helm chart: chart README and values
- Garage documentation
Development
See CONTRIBUTING.md for the full development and pull request workflow.
make dev-up # Start kind cluster with operator
make dev-test # Apply test resources
make dev-status # View cluster status
make dev-logs # Stream operator logs
make dev-down # Tear down
Explore related projects
Loading…