---
title: Charmhub | Deploy Charmed PostgreSQL K8s using Charmhub - The Open Operator
  Collection
description: Deploy the latest version of Charmed PostgreSQL K8s as a Kubernetes Operator
  on any cloud.
url: https://charmhub.io/postgresql-k8s/libraries/postgresql_tls
---

# Charmed PostgreSQL K8s

[Canonical](https://charmhub.io/publisher/data-platform "View all packages from Canonical")

* [Canonical](https://charmhub.io/publisher/data-platform "View all packages from Canonical")
* [Databases](https://charmhub.io/?filter=databases)

Platform:

14/stable 960

```
juju deploy postgresql-k8s --channel 14/stable --trust
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/postgresql-k8s/libraries/postgresql_tls#drawer)

## charms.postgresql\_k8s.v0.postgresql\_tls

* [*Docstrings*Docstrings](https://charmhub.io/postgresql-k8s/libraries/postgresql_tls)
  [*Code*Source code](https://charmhub.io/postgresql-k8s/libraries/postgresql_tls/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.postgresql_k8s.v0.postgresql_tls
    ```

    [Download postgresql\_tls.py](https://charmhub.io/postgresql-k8s/libraries/postgresql_tls/download)
  + *Last updated* 28 Jan 2026
  + *Revision* Library version 0.16

In this class we manage certificates relation.

This class handles certificate request and renewal through
the interaction with the TLS Certificates Operator.

This library needs that the following libraries are imported to work:

* https://charmhub.io/certificate-transfer-interface/libraries/certificate\_transfer
* https://charmhub.io/tls-certificates-interface/libraries/tls\_certificates

It also needs the following methods in the charm class:
— get\_hostname\_by\_unit: to retrieve the DNS hostname of the unit.
— get\_secret: to retrieve TLS files from secrets.
— push\_tls\_files\_to\_workload: to push TLS files to the workload container and enable TLS.
— set\_secret: to store TLS files as secrets.
— update\_config: to disable TLS when relation with the TLS Certificates Operator is broken.

---

Index

* [class PostgreSQLTLS](https://charmhub.io/postgresql-k8s/libraries/postgresql_tls#postgresqltls)
* + [def \_\_init\_\_(
    self,
    charm,
    peer\_relation,
    additional\_dns\_names)](https://charmhub.io/postgresql-k8s/libraries/postgresql_tls#postgresqltls-__init__)
* + [def get\_tls\_files(
    self)](https://charmhub.io/postgresql-k8s/libraries/postgresql_tls#postgresqltls-get_tls_files)

#### class PostgreSQLTLS

Description

In this class we manage certificates relation. None

Methods

PostgreSQLTLS.
\_\_init\_\_(

*self*

,
charm

,
peer\_relation: str

,
additional\_dns\_names
)

Description

Manager of PostgreSQL relation with TLS Certificates Operator. None

PostgreSQLTLS.
get\_tls\_files(

*self*
)

Prepare TLS files in special PostgreSQL way.

Description

PostgreSQL needs three files:
— CA file should have a full chain.
— Key file should have private key.
— Certificate file should have certificate without certificate chain.
