1.3. Modifying Central custom resource for external database
Prerequisites
You must have a database in your database instance that supports PostgreSQL 13 and a user with the following permissions:
- Connection rights to the database.
-
UsageandCreateon the schema. -
Select,Insert,Update, andDeleteon all tables in the schema. Usageon all sequences in the schema.重要- Postgres 15 is the recommended and supported version. Red Hat has deprecated the support for Postgres 13 and will remove it in the newer versions of RHACS.
-
If you use Kubernetes, enter
kubectlinstead ofoc.
Procedure
Create a password secret in the deployed namespace by using the OpenShift Container Platform web console or the terminal.
-
On the OpenShift Container Platform web console, go to the Workloads
Secrets page. Create a Key/Value secret with the key passwordand the value as the path of a plain text file containing the password for the superuser of the provisioned database. Or, run the following command in your terminal:
$ oc create secret generic external-db-password \ --from-file=password=<password.txt>where:
<password.txt>- Specifies the path of the file which has the plain text password.
-
On the OpenShift Container Platform web console, go to the Workloads
- Go to the Red Hat Advanced Cluster Security for Kubernetes operator page in the OpenShift Container Platform web console. Select Central in the top navigation bar and select the instance you want to connect to the database.
- Go to the YAML editor view.
-
For
db.passwordSecret.namespecify the referenced secret that you created in earlier steps. For example,external-db-password. -
For
db.connectionStringspecify the connection string inkeyword=valueformat, for example,host=<host> port=5432 database=stackrox user=stackrox sslmode=verify-ca -
For
db.persistencedelete the entire block. If necessary, you can specify a Certificate Authority for Central to trust the database certificate by adding a TLS block under the top-level spec, as shown in the following example:
Update the central custom resource with the following configuration:
spec: tls: additionalCAs: - name: db-ca content: | <certificate> central: db: isEnabled: Default connectionString: "host=<host> port=5432 user=<user> sslmode=verify-ca" passwordSecret: name: external-db-passwordwhere:
spec.central.db.isEnabled-
Specifies that you must not change the value of
IsEnabledtoEnabled.
- Click Save.