Skip to content

Commit b42e4c8

Browse files
Add documentation for k8s secrets
1 parent 0a62f3e commit b42e4c8

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/admin/deploy/kubernetes/configure.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,38 @@ For example, to update the value for `SYMBOLS_CACHE_SIZE_MB`:
10521052

10531053
You can use an external or managed version of PostgreSQL and Redis with your Sourcegraph instance. For detailed information as well as the requirements for each service, please see our docs on [using external services with Sourcegraph](/admin/external_services/).
10541054

1055+
### External Secrets
1056+
1057+
For ensuring password protection, it is recommended to use [External Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) to manage your secrets.
1058+
1059+
To create a kubernetes secret you can use the following command:
1060+
1061+
```shell
1062+
kubectl create secret generic pgsql-secret --from-literal=password=YOUR_SECURE_PASSWORD_HERE
1063+
```
1064+
1065+
Then replace the password in the yaml files it's located in, based on the deployment method you are using.
1066+
Below is the example Helm deployment files modified to reference this secret.
1067+
1068+
```yaml
1069+
# sourcegraph-frontend.Deployment.yaml
1070+
spec:
1071+
template:
1072+
spec:
1073+
containers:
1074+
- name: frontend
1075+
env:
1076+
- name: PGPASSWORD
1077+
valueFrom:
1078+
secretKeyRef:
1079+
name: pgsql-secret
1080+
key: password
1081+
```
1082+
1083+
You can then drop the environment variable `PGPASSWORD` from the default deployment.
1084+
1085+
Similar changes will be required for other pods and services, depending on the secret being used. It's recommended to read the [official documentation](https://kubernetes.io/docs/concepts/configuration/secret/) to understand how Kubernetes secrets work.
1086+
10551087
### External Postgres
10561088

10571089
For optimal performance and resilience, it is recommended to use an external database when deploying Sourcegraph. For more information on database requirements, please refer to the [Postgres guide](/admin/postgres).

0 commit comments

Comments
 (0)