The External Secrets Enterprise product suite is a premium product.
It requires a specific subscription. Contact us for more information.
In order to use the PostgreSQL User Generator, you must have the Enterprise Distribution of ESO available via ESI Agent or via our Helm chart bundle
Introduction
The PostgreSQL User Generator for ESO allows you to dynamically create and rotate database users with native integration. This is useful when providing applications with scoped credentials to PostgreSQL, reducing the operational overhead of manual user management and improving security posture.Output Keys and Values
Key | Description |
---|---|
username | The generated PostgreSQL username |
password | The generated PostgreSQL password |
Parameters
Key | Default | Description |
---|---|---|
database | postgres | The name of the PostgreSQL database to connect to. |
host | Required | The hostname or IP of the PostgreSQL server. |
port | 5432 | The port used to connect to the PostgreSQL server. |
auth.username | postgres | Admin username for authentication. |
auth.password.name | Required | Kubernetes secret name containing the admin password. |
auth.password.key | Required | Key in the secret that holds the admin password. |
user.username | Required | The username to create. A random suffix will be appended. |
user.suffixSize | 8 | Length of the random suffix appended to the username. If set to 0, no suffix is appended. |
user.attributes | [] | List of PostgreSQL attributes to assign. Each item must be an object with a name field (e.g., CREATEDBT ) and an optional value field for attributes that require a parameter (e.g.,CONNECTION LIMIT ). |
user.roles | [] | List of existing roles to grant to the user. Non-existent roles are created with no attributes. |
user.destructiveCleanup | false | If true , all owned objects are dropped during cleanup. Otherwise, ownership is reassigned to the reassignTo user. |
user.reassignTo | - | The name of the role to which all owned objects should be reassigned during cleanup. auth.username is used if not set. |
Set up
PostgreSQL Permissions
The admin user provided in the spec must have sufficient permissions to create and delete users in PostgreSQL. Typically, the built-inpostgres
admin account has the required permissions.
Generator Config
ExternalSecret Config
Using the Generated Secret
Notes and Considerations
- If destructiveCleanup is true, owned objects are dropped before dropping the user.
- If destructiveCleanup is false, ownership is reassigned to the user defined in user.reassignTo.
- If user.reassignTo is not set, the admin user defined in auth.username is used for reassignment.
- If user.reassignTo does not exists, it will be created with no attributes or roles.
- Roles listed in user.roles are created if missing and assigned to the generated user.
- Only the standard PostgreSQL attributes (SUPERUSER, CREATEDB, CREATEROLE, REPLICATION) are supported.