postgres
37 pagesAdditional users
You can add users to your database by setting database configuration option: .spec.gcp.sqlInstances[].databases[].users[].name. Additional users needs to manually be given access to the database andβ¦
Certification sync issues
If you have deleted your application and recreate it, there might be an issue that your new app will not be able to create a client certificate because the old one still exists. Your deploy may failβ¦
Change the tier of your database instance
Choosing an appropriate tier depends on your application's requirements such as: The tier you choose will affect the performance and cost of your database.
Change your Cloud SQL instance
Nais no longer provides database migration tooling. Choose the procedure for the change you need. Upgrade PostgreSQL on your existing instance. You do not need to migrate to a new instance. Plan forβ¦
Cloud SQL credentials
Cloud SQL uses ConfigConnector/CNRM to create and manage all relevant resources (sqldatabase, sqlinstance, sqluser, credentials) for postgreSQL. When creating an application via your nais.yaml theβ¦
Cloud SQL Instance
A Cloud SQL instance is a managed database server provided by Google Cloud Platform. In nais, these are used to provide PostgreSQL databases for your applications.
Cloud SQL Proxy
The application will connect to the database using Cloud SQL Proxy, ensuring that the database communication happens in secure tunnel, authenticated with automatically rotated credentials.
Cloud SQL System Users and Roles
Every Cloud SQL PostgreSQL instance comes with a fixed set of system users and roles managed by Google. On top of these, Nais creates application-specific users via ConfigConnector. Understandingβ¦
Connect to a cloned database
If you have for some reason cloned a database in the console, you need to do some manually changes on the new database to be allowed to connect to it with your.
Connect to Postgres as a personal user
Use this how-to to connect to a Postgres database with your personal user, for ad-hoc queries and inspection.
Create Postgres
Create a Postgres database. Provisioning continues asynchronously. Follow the status on the database's page in Nais Console.
Debugging
When issues arise with your Cloud SQL instance, you can use the following steps to troubleshoot the problem.
Delete Postgres
Deleting a Postgres irreversibly removes the whole instance with all its branches and data. Remove uses.postgres from all workloads that reference the database and deploy them. If the Postgresβ¦
Deleting the database
The database is not automatically removed when deleting your Nais application. Remove unused databases to avoid incurring unnecessary costs. This is done by setting cascadingDelete in yourβ¦
Enable audit logging
This guide describes how to enable audit logging in your postgreSQL database. The following steps need to be taken to enable the logging.
Failing to assign private IP to an existing Cloud SQL instance
If you have deleted your application and recreate it, there might be an issue that your new app will not be able to create a client certificate because the old one still exists. Your deploy may failβ¦
Grants and privileges
nais cloudsql prepare grants PostgreSQL privileges, not login access. By default, it grants USAGE on the schema and SELECT on existing tables and sequences to cloudsqliamuser. It also sets defaultβ¦
Legacy Cloud SQL migration (deprecated)
The CLI saves migration configuration in the cluster and launches Naisjobs running cloudsql-migrator <span class="emoji-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px"β¦
Manage Postgres
Change CPU, memory, disk size or high availability. PostgreSQL 18 is the only supported major version in preview; the CLI update command does not change the major version.
Nais Postgres example YAML
This is a complete example of a Postgres resource, commonly known as the postgres.yaml file. For an in-depth explanation of each field, head over to the reference documentation.
Nais Postgres reference
This document describes all possible configuration values in the Postgres spec, commonly known as the postgres.yaml file. A Postgres is a logical database: pgrator creates its default main branch asβ¦
Non-personal database users
This page documents the non-personal users in Google Cloud SQL for PostgreSQL on Nais. It covers the default setup (golden path). Manual deviations β such as setting a password on the postgres userβ¦
Personal database access
Use your personal Google account to access a Cloud SQL database. Database privileges and login access are separate: prepare grants PostgreSQL privileges, but does not create an IAM database user orβ¦
Postgres
Postgres gives your Applications and Jobs a managed PostgreSQL database. You can create a database yourself and connect your workloads to it.
Postgres branches
A Postgres can have several branches. Each branch is a separate, writable database with its own data and history. Branch names belong to one Postgres, so different databases can each have a branchβ¦
Postgres database metrics
All Postgres databases running on Google Cloud Platform are integrated with Cloud Monitoring to provide metrics and alerts. You can use these metrics to monitor the health and performance of yourβ¦
Postgres extensions
The PostgreSQL 18 image used by Postgres includes the extensions below. Available extensions are not necessarily enabled in your database. plpgsql is installed by default; the platform alsoβ¦
Postgres personal access
The nais postgres psql and nais postgres proxy commands grant your personal user temporary access to a Postgres database. For usage, see Connect to Postgres as a personal user.
Postgres reference
The full configuration options for the Postgres instance can be found in the application spec reference.
Postgres workload credentials
When an Application or Job uses a Postgres database, Postgres provides connection settings as environment variables. Workloads authenticate with TLS client certificates; no password is provided.
Reset database credentials
To reset the database credentials for your application (if application name, database name or envVarPrefix has been changed), you need to first delete the secret and sqluser for the database:
Restore a database from a daily backup
This page describes how to restore a Cloud SQL Postgres database from one of the automated daily backups that Nais takes of your instance.
Restore a Postgres branch from backup
The restore creates a new, writable branch from a point in time covered by the source branch's backups. It does not change your workloads.
Shrink Cloud SQL disk size
Shrink storage on your existing instance using gcloud. Follow Google's storage shrink procedure <span class="emoji-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0β¦
Upgrade major version
This page describes how to upgrade the major version of your PostgreSQL database. Before doing a major version upgrade, consult the Google Cloud SQL documentation for any preparation that needs to beβ¦
Use Postgres in a workload
Add the database to your Application or Job manifest in the same team and environment: Replace <POSTGRES-NAME> with the database name you used in Create Postgres, then deploy the workload as usual.β¦
Workaround for password synchronization issues
We recommend using nais-cli for rotating password for your Postgres database user. Retrieve the password from the secret google-sql-MYAPP in your namespace (the password is base64 encoded):