Creating Pods with PostgreSQL and Commvault Docker Containers

Configure the YAML files to create the pods with the PostgreSQL and the Commvault Docker containers.

Before We Begin

  • For FSBased backups, the PostgreSQL container image available on the Docker Hub does not have archive_mode or archive_command enabled by default. To enable these features, you need to create a custom PostgreSQL image based on the official PostgreSQL image. Then, this custom image is used to deploy the pod.

You can refer to the Docker file below to build the custom PostgreSQL image. To know more about the official PostgreSQL docker image customization, see PostgreSQL Docker.

####Docker File####

For Example:

# Use official PostgreSQL image
FROM postgres:16.8

    # Add archive settings to postgresql.conf using echo

    RUN echo "echo \"archive_mode = on\" >> /var/lib/postgresql/data/postgresql.conf" > /docker-entrypoint-initdb.d/00-config.sh && \echo "echo \"archive_command = 'cp %p /var/lib/postgresql/archive/dir/%f'\" >> /var/lib/postgresql/data/postgresql.conf" >> /docker-entrypoint-initdb.d/00-config.sh && \echo "mkdir /var/lib/postgresql/archive/dir" >> /docker-entrypoint-initdb.d/00-config.sh && \echo "chmod -R 777 /var/lib/postgresql/archive/dir" >> /docker-entrypoint-initdb.d/00-config.sh && \echo "chown -R postgres:postgres /var/lib/postgresql/archive/dir" >> /docker-entrypoint-initdb.d/00-config.sh

    # Ensure archive.sh has execution permissions

    RUN chmod +x /docker-entrypoint-initdb.d/00-config.sh

Commands to create custom PostgreSQL image with Docker file

docker build -f DOCKER_FILE_PATH -t postgresql_custom:1

Procedure

  1. Create the following PostgreSQL configuration files on the master node of the Kubernetes cluster:

    • The commcell_secret.yaml file has the Command Center user name and password.

    • The cv-configmap.yaml file has CommServe information such as the host name, client name, and IP address.

    • The postgres-configmap.yaml file has PostgreSQL configuration information such as the PostgreSQL database name, username, and password.

    • The postgres-service.yaml file has the port number to be used by the PostgreSQL server.

    • The pgsql-statefulset.yaml file has the image and volume information needed for creating the pod. If you need to run the Commvault container as a non-root user, use the pgsql-statefulset-non-root.yaml file.

      Note

      • Create the pgsql-statefulset.yaml file only after all the other files are created.

      • Give the Docker containers names that will cause them to be automatically added to the smart server group.

      • You can use Commvault PostgreSQL image for Commvault container. For more information, refer to Commvault Postgresql.

  2. Run the following command from the Kubernetes cluster for each YAML file:

    kubectl create -f file_name

    Important

    Apply the pgsql-statefulset.yaml file only after all the other files have been applied.

Result

  • Based on the number of replicas in the statefulset.yaml file example given above, the same number of pods are created, and the client appears in the server group. Each pod contains both the Commvault Docker container and the PostgreSQL Docker container.

  • The number of clients registered to the CommCell environment is the same as the number of pods created. Data protection operations are run from the individual clients considering them as standalone clients.

What to Do Next

Verify that the server group is ready to perform backups and restores. For more information, see Checking Readiness.

Note

Perform instance creation using the binaries and libraries present in the <Install_dir>/CVCloudAddOns/PostgreSQL/<VERSION> directory.

×

Loading...