Skip to content

Commit 3e8a45f

Browse files
d-bytebaseclaude
andcommitted
docs: improve Kubernetes deployment section in external PostgreSQL guide
- Rename "Running with Kubernetes" to "Kubernetes Deployment" for clarity - Reorganize secret configuration with clearer subheadings - Add comprehensive example for mounting secrets as files - Document automatic secret rotation behavior with file mounts - Clarify that Bytebase monitors file changes for seamless updates 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 70a85a1 commit 3e8a45f

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

mintlify/get-started/self-host/external-postgres.mdx

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,25 @@ This bash script demonstrates how to add an external PostgreSQL database as the
7272

7373
<TerminalDockerRunPgUrl />
7474

75-
## Running with Kubernetes
75+
## Kubernetes Deployment
7676

77-
### Using Connection String in YAML
77+
### Direct Configuration
7878

79-
You can specify the PostgreSQL connection string directly in your Kubernetes YAML file:
79+
Configure the PostgreSQL connection directly in your deployment manifest:
8080

8181
```yaml
8282
env:
8383
- name: PG_URL
8484
value: 'postgresql://<<user>>:<<secret>>@<<host>>:<<port>>/<<dbname>>'
8585
```
8686
87-
### Using Kubernetes Secrets
87+
### Secret-Based Configuration
8888
89-
Instead of specifying PostgreSQL connection string directly in Helm or Kubernetes yaml file, you can use Kubernetes secrets resources:
89+
For enhanced security, store your PostgreSQL connection string in a Kubernetes Secret:
9090
91-
#### Kubernetes
91+
#### Using Secret as Environment Variable
9292
93-
Use the following yaml section to replace the `spec.templates.spec.containers.env` section:
93+
Add the following environment variable configuration to your deployment's `spec.templates.spec.containers.env` section:
9494

9595
```yaml
9696
env:
@@ -101,3 +101,31 @@ env:
101101
key: secret_key
102102
```
103103

104+
#### Using Secret as File Mount
105+
106+
Mount the secret as a file and point `PG_URL` to the file path. This approach supports automatic secret rotation - when the Kubernetes Secret is updated, the mounted file content is automatically refreshed, and Bytebase will pick up the new connection string without requiring a restart:
107+
108+
```yaml
109+
spec:
110+
containers:
111+
- name: bytebase
112+
env:
113+
- name: PG_URL
114+
value: "/var/secrets/pg-connection/url"
115+
volumeMounts:
116+
- name: pg-secret
117+
mountPath: "/var/secrets/pg-connection"
118+
readOnly: true
119+
volumes:
120+
- name: pg-secret
121+
secret:
122+
secretName: bytebase-pg-secret
123+
items:
124+
- key: connection-string
125+
path: url
126+
```
127+
128+
<Note>
129+
When using file-based secrets, Kubernetes automatically updates the mounted file content when the Secret is updated (typically within a minute). Bytebase monitors the file for changes and automatically reloads the connection string, enabling seamless secret rotation without downtime.
130+
</Note>
131+

0 commit comments

Comments
 (0)