Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
75 lines (57 loc) · 2.15 KB

File metadata and controls

75 lines (57 loc) · 2.15 KB
Copy raw file
Download raw file
Outline
Edit and raw actions

Configure Coder to connect to PostgreSQL using SSL

February 24, 2024

Your organization may require connecting to the database instance over SSL. To supply Coder with the appropriate certificates, and have it connect over SSL, follow the steps below:

Client verification (server verifies the client)

  1. Create the certificate as a secret in your Kubernetes cluster, if not already present:
kubectl create secret tls postgres-certs -n coder --key="postgres.key" --cert="postgres.crt"
  1. Define the secret volume and volumeMounts in the Helm chart:
coder:
  volumes:
    - name: "pg-certs-mount"
      secret:
        secretName: "postgres-certs"
  volumeMounts:
    - name: "pg-certs-mount"
      mountPath: "$HOME/.postgresql"
      readOnly: true
  1. Lastly, your PG connection URL will look like:
postgres://<user>:<password>@databasehost:<port>/<db-name>?sslmode=require&sslcert="$HOME/.postgresql/postgres.crt&sslkey=$HOME/.postgresql/postgres.key"

Server verification (client verifies the server)

  1. Download the CA certificate chain for your database instance, and create it as a secret in your Kubernetes cluster, if not already present:
kubectl create secret tls postgres-certs -n coder --key="postgres-root.key" --cert="postgres-root.crt"
  1. Define the secret volume and volumeMounts in the Helm chart:
coder:
  volumes:
    - name: "pg-certs-mount"
      secret:
        secretName: "postgres-certs"
  volumeMounts:
    - name: "pg-certs-mount"
      mountPath: "$HOME/.postgresql/postgres-root.crt"
      readOnly: true
  1. Lastly, your PG connection URL will look like:
postgres://<user>:<password>@databasehost:<port>/<db-name>?sslmode=verify-full&sslrootcert="/home/coder/.postgresql/postgres-root.crt"

More information on connecting to PostgreSQL databases using certificates can be found in the PostgreSQL documentation.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.