You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme-docs/KUBERNETES.md
+78Lines changed: 78 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -375,6 +375,84 @@ extraEnv:
375
375
value: '26379'
376
376
```
377
377
378
+
379
+
### How to use an external PostgreSQL DB with Defectdojo
380
+
381
+
#### Step 1: Create a Namespace for DefectDojo
382
+
383
+
To begin, create a dedicated namespace for DefectDojo to isolate its resources:
384
+
`kubectl create ns defectdojo`
385
+
#### Step 2: Create a Secret for PostgreSQL Credentials
386
+
387
+
Set up a Kubernetes Secret to securely store the PostgreSQL user password and database connection URL, which are essential for establishing a secure connection between DefectDojo and your PostgreSQL instance. Apply the secret using the following command: `kubectl apply -f secret.yaml -n defectdojo`. This secret will be referenced within the `extraEnv` section of the DefectDojo Helm values file.
388
+
389
+
Sample secret template (replace the placeholders with your PostgreSQL credentials):
390
+
```YAML
391
+
apiversion: v1
392
+
kind: Secret
393
+
metadata:
394
+
name: defectdojo-postgresql-specific
395
+
type: Opaque
396
+
stringData: # I chose stringData for better visualization of the credentials for debugging
Sample `values.yaml` file for PostgreSQL configuration:
413
+
414
+
```YAML
415
+
auth:
416
+
username: defectdojo
417
+
password: <user-password>
418
+
postgresPassword: <admin-password>
419
+
database: defectdojo
420
+
primary:
421
+
persistence:
422
+
size: 10Gi
423
+
```
424
+
425
+
#### Step 3: Modify DefectDojo helm values
426
+
427
+
Before installing the DefectDojo Helm chart, it's important to customize the `values.yaml` file. Key areas to modify include specifying the PostgreSQL connection details & the extraEnv block:
428
+
429
+
```yaml
430
+
database: postgresql
431
+
postgresql:
432
+
postgresServer: "defectdojo-postgresql" # point to the hostname of your postgresql server
433
+
enabled: false
434
+
435
+
# Specify the postgresql DB connection url for the external postgresql server
436
+
extraEnv:
437
+
- name: DD_DATABASE_URL
438
+
valueFrom:
439
+
secretKeyRef:
440
+
name: defectdojo-postgresql-specific
441
+
key: db-url
442
+
```
443
+
444
+
#### Step 4: Deploy DefectDojo
445
+
446
+
After modifying the `values.yaml` file as needed, deploy DefectDojo using Helm. This command also generates the required secrets for the DefectDojo admin UI and Redis:
**NOTE**: It is important to highlight that this setup can also be utilized for achieving high availability (HA) in PostgreSQL. By placing a load balancer in front of the PostgreSQL cluster, read and write requests can be efficiently routed to the appropriate primary or standby servers as needed.
0 commit comments