Skip to content

setup database certificates#623

Merged
boddumanohar merged 1 commit intodevfrom
db-certs
Mar 4, 2026
Merged

setup database certificates#623
boddumanohar merged 1 commit intodevfrom
db-certs

Conversation

@boddumanohar
Copy link
Member

@boddumanohar boddumanohar commented Feb 20, 2026

Fixes: simplyblock/vela#169

The database connection endpoint connects to PGBouncer service. So the changes in PR sets up TLS termination for at PGBouncer.

As a part of this changes, we create the certificate:

  • Create the certificate as a part of Helm chart
  • update PGBouncer Config to require certificates
  • update vm.yaml definition with certificates

We first provision a temporary certificate (using the annotation: cert-manager.io/issue-temporary-certificate: "true") and then the certificate will be replaced by the actual lets encrypt certificate.

initially PSQL connection works.

root@pgbench2:/# psql "postgresql://postgres@db.01kjw123b90acqvn6ext0a7m4v.pr623.dev.kernel-labs.org:32138/postgres"
psql (17.8 (Debian 17.8-1.pgdg13+1), server 18.1)
WARNING: psql major version 17, server major version 18.
         Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: postgresql)
Type "help" for help.

postgres=> \q

but then it doesn't work verify-full mode.

root@pgbench2:/# psql "postgresql://postgres@db.01kjw123b90acqvn6ext0a7m4v.pr623.dev.kernel-labs.org:32138/postgres?sslmode=verify-full&sslrootcert=system"
psql: error: connection to server at "db.01kjw123b90acqvn6ext0a7m4v.pr623.dev.kernel-labs.org" (34.141.107.241), port 32138 failed: SSL error: certificate verify failed

after sometime it works again. Because the certificate will be replaced by lets encrypt's TLS secret

root@pgbench2:/# psql "postgresql://postgres@db.01kjw123b90acqvn6ext0a7m4v.pr623.dev.kernel-labs.org:32138/postgres?sslmode=verify-full&sslrootcert=system"
psql (17.8 (Debian 17.8-1.pgdg13+1), server 18.1)
WARNING: psql major version 17, server major version 18.
         Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: postgresql)
Type "help" for help.

postgres=> \q

and on the image logs

TLS explicitly required by configuration. Waiting for certificates...
Certificates found. Starting hot-reload watcher in background...
Certificates modified, reloading PgBouncer...

@boddumanohar boddumanohar marked this pull request as draft February 23, 2026 11:09
Base automatically changed from dev to main February 23, 2026 13:45
@boddumanohar boddumanohar force-pushed the db-certs branch 2 times, most recently from 88994e4 to ac9354d Compare February 25, 2026 10:29
@boddumanohar boddumanohar changed the base branch from main to dev February 25, 2026 10:29
@boddumanohar boddumanohar force-pushed the db-certs branch 2 times, most recently from e059c1e to d052469 Compare February 26, 2026 03:26
@boddumanohar boddumanohar marked this pull request as ready for review February 26, 2026 03:31
@boddumanohar boddumanohar marked this pull request as draft February 26, 2026 12:09
Base automatically changed from dev to main February 27, 2026 14:33
@boddumanohar boddumanohar changed the base branch from main to dev February 28, 2026 16:32
@boddumanohar boddumanohar marked this pull request as ready for review March 1, 2026 03:09
@boddumanohar boddumanohar requested a review from mxsrc March 1, 2026 03:09
@boddumanohar boddumanohar reopened this Mar 2, 2026
Copy link
Collaborator

@mxsrc mxsrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, otherwise it looks good.

@boddumanohar boddumanohar merged commit a63381e into dev Mar 4, 2026
7 checks passed
@boddumanohar boddumanohar deleted the db-certs branch March 4, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Databases should be connected via TLS

3 participants