Skip to content

Commit 9fb24aa

Browse files
committed
docs: document datastoreTLSSecretName mount path and usage
Adds comprehensive documentation for configuring datastore TLS certificates using the datastoreTLSSecretName configuration option. ## Changes - Add main README section explaining TLS certificate configuration - Include example for PostgreSQL/CockroachDB with TLS - Document certificate mount paths at /spicedb-db-tls - Add TLS configuration section to cockroachdb-tls-ingress example - Fix markdown lint errors (list numbering and spacing) Fixes #170
1 parent 43792fd commit 9fb24aa

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,55 @@ zed --insecure --endpoint=localhost:50051 --token=averysecretpresharedkey schema
8484
- Learn how to use SpiceDB via the [docs](https://docs.authzed.com/) and [playground](https://play.authzed.com/).
8585
- Ask questions and join the community in [discord](https://authzed.com/discord).
8686

87+
## Configuration
88+
89+
### Datastore TLS Certificates
90+
91+
If your datastore requires TLS client certificates for authentication, you can configure SpiceDB to use them via the `datastoreTLSSecretName` configuration option.
92+
93+
When configured, the operator will mount the specified secret's contents at `/spicedb-db-tls` (read-only) in both the SpiceDB pods and migration jobs. You can then reference these certificate files in your `datastore_uri` connection string.
94+
95+
#### Example: PostgreSQL/CockroachDB with TLS
96+
97+
1. Create a Kubernetes secret containing your TLS certificates:
98+
99+
```console
100+
kubectl create secret generic my-db-tls \
101+
--from-file=ca.crt=/path/to/ca.crt \
102+
--from-file=tls.crt=/path/to/client.crt \
103+
--from-file=tls.key=/path/to/client.key
104+
```
105+
106+
1. Configure your SpiceDBCluster to use the secret:
107+
108+
```yaml
109+
apiVersion: authzed.com/v1alpha1
110+
kind: SpiceDBCluster
111+
metadata:
112+
name: production
113+
spec:
114+
config:
115+
datastoreEngine: cockroachdb
116+
datastoreTLSSecretName: my-db-tls
117+
secretName: production-spicedb-config
118+
---
119+
apiVersion: v1
120+
kind: Secret
121+
metadata:
122+
name: production-spicedb-config
123+
stringData:
124+
datastore_uri: "postgresql://[email protected]:26257/spicedb?sslmode=verify-full&sslrootcert=/spicedb-db-tls/ca.crt&sslcert=/spicedb-db-tls/tls.crt&sslkey=/spicedb-db-tls/tls.key"
125+
preshared_key: "your-secret-key"
126+
```
127+
128+
The certificates will be available at these paths inside the SpiceDB containers:
129+
130+
- `/spicedb-db-tls/ca.crt` - CA certificate
131+
- `/spicedb-db-tls/tls.crt` - Client certificate
132+
- `/spicedb-db-tls/tls.key` - Client private key
133+
134+
Note: The exact SSL parameter names depend on your datastore's connection driver. Consult your datastore's documentation for the correct connection string format.
135+
87136
## Automatic and Suggested Updates
88137

89138
The SpiceDB operator now ships with a set of release channels for SpiceDB.

examples/cockroachdb-tls-ingress/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,39 @@ kubectl apply --server-side -k .
8585
It is safe and may be necessary to run this multiple times if any of the resources fail to apply.
8686
CRDs especially may fail to create, so check the output for them.
8787

88+
## Datastore TLS (Optional)
89+
90+
This example configures TLS for SpiceDB's API endpoints and internal dispatch communication, but the CockroachDB database connection uses `sslmode=disable` for simplicity.
91+
92+
If your production database requires TLS client certificates, you can configure them using the `datastoreTLSSecretName` option:
93+
94+
1. Create a secret with your database TLS certificates:
95+
96+
```sh
97+
kubectl create secret generic db-tls-certs \
98+
--namespace spicedb \
99+
--from-file=ca.crt=/path/to/db-ca.crt \
100+
--from-file=tls.crt=/path/to/db-client.crt \
101+
--from-file=tls.key=/path/to/db-client.key
102+
```
103+
104+
1. Add `datastoreTLSSecretName` to the SpiceDB cluster config in `spicedb/spicedb.yaml`:
105+
106+
```yaml
107+
spec:
108+
config:
109+
datastoreTLSSecretName: db-tls-certs
110+
```
111+
112+
1. Update the `datastore_uri` in the secret to reference the mounted certificates at `/spicedb-db-tls`:
113+
114+
```yaml
115+
stringData:
116+
datastore_uri: "postgresql://[email protected]:26257/defaultdb?sslmode=verify-full&sslrootcert=/spicedb-db-tls/ca.crt&sslcert=/spicedb-db-tls/tls.crt&sslkey=/spicedb-db-tls/tls.key"
117+
```
118+
119+
See the main [README](../../README.md#datastore-tls-certificates) for more details.
120+
88121
## Connect with `zed`
89122

90123
If you haven't already, make sure you've installed [zed](https://github.com/authzed/zed#installation).

0 commit comments

Comments
 (0)