For Kaspersky Container Security, you can use PostgreSQL databases included in the solution or your own PostgreSQL databases. To install an external PostgreSQL database that does not work with the Kaspersky Container Security schema, you must create a separate user. You can do this by installing the Helm Chart package with the schema parameters specified for the external PostgreSQL database.
To use an external PostgreSQL database:
--set default.postgresql.external="true"
--set configmap.infraconfig.envs.postgres_host="<IP address or FQDN of PostgresSQL DBMS
>"
--set configmap.infraconfig.envs.postgres_port="<port for connection to PostgresSQL DBMS; by default, port 5432 is used>
"
--set configmap.infraconfig.envs.postgres_db_name="name of the database created by the PostgresSQL DBMS administrator, api is used by default
>"
--set configmap.infraconfig.envs.postgres_verify_level= "disable”
– the server certificate is not verified.--set configmap.infraconfig.envs.postgres_verify_level= "require”
– the certificate is required, the solution trusts any certificate without any further verification.--set configmap.infraconfig.envs.postgres_verify_level= "verify-ca”
– the certificate is required, the solution checks that the certificate is issued by a trusted CA (Certificate Authority).--set configmap.infraconfig.envs.postgres_verify_level= "verify-full”
– the certificate is required, the solution verifies that the certificate is issued by a trusted CA and contains the correct IP address or FQDN.certs/pgsql-ca.crt
mask.--set configmap.infraconfig.envs.postgres_root_ca_path="/etc/ssl/certs/pgsql-ca.crt"
.secret.cert-pgsql-ca
section in the values.yaml configuration file to create the secret.To create a user with a custom schema for an external PostgreSQL database:
kubectl create ns kcspg
where kcspg
is the namespace for the external PostgreSQL database.
Parameters for deploying the external PostgreSQL database
The parameters specify the password of the database. You must then specify this password in the infraconfig
section of the values.yaml configuration file, which is part of the Helm Chart package included in the distribution kit of the solution.
kubectl apply -f pg.yaml -n kcspg
The name of this external database is formed as follows:
<
pod_name
>.<
namespace name
>.<
service
>.cluster.local
For example, postgres.kcspg.svc.cluster.local
kubectl apply -f svc.yaml -n kcspg
psql -h localhost -U postgres -d api
CREATE ROLE kks LOGIN PASSWORD 'kks' NOINHERIT CREATEDB;
CREATE SCHEMA kks AUTHORIZATION kks;
GRANT USAGE ON SCHEMA kks TO PUBLIC;
Parameters in the values.yaml file
The values of the parameters specified in values.yaml must match the values of corresponding parameters in the pg.yaml and svc.yaml configuration files.
Example of commands to create a user with an external PostgreSQL database