Connecting to external Postgres and Redis

Caution

Anaconda recommends you connect to an external Postgres instance immediately after installation completes. If you do not, you will have to create a dump file from the internal Anaconda Enterprise Postgres instance to import into your own Postgres instance.


You can connect Anaconda Enterprise 5 (AE5) to your organization’s pre-existing Postgres or redis instance for both Gravity and BYOK8s installations. Connecting to an external Postgres or redis instance enables you to take advantage of multiple High Availability/Disaster Recovery (HA/DR) options your organization may already have in place.

Connecting to an external Postgres instance that is hosted within the same cluster is also supported! For example; your organization can have a multi-namespace/region deployment of Postgres within your cluster that connects to AE5 via the service name. Combining this with Persistent Storage (dynamic block) and Managed Persistence enables AE5 to rapidly move from any failing node via standard Kubernetes pod scheduling.

Connecting to external Postgres

The following databases are automatically created in your Postgres instance:

anaconda_auth
anaconda_auth_escrow
anaconda_deploy
anaconda_git
anaconda_operation_controller
anaconda_repository
anaconda_storage
anaconda_ui
anaconda_workspace

To connect to your external Postgres instance:

  1. Create an AE5 account with read/write access and set the account’s password.

  2. Open your anaconda-enterprise-anaconda-platform.yml file and edit the following section:

    db: # Database client configuration
     host: <IP/Hostname> # Database hostname
     port: 5432
     username: "<postgres-account>"
     password: "<password>"
    
  3. Save your changes, then restart all pods:

    kubectl get pods | grep ap- | cut -d' ' -f1 | xargs kubectl delete pods
    
  4. Once the pods are in a running state, confirm all databases in Postgres have been created.

    Note

    If pods show a crashloop state, inspect the pod logs. The most common cause of a crashloop state is a misconfiguration.

    Note

    Openshift may require updating the environmental variables for the anaconda-enterprise-ap-auth deployment if the anaconda_auth database is not created in Postgres.


The following environmental variables must be changed in the anaconda-enterprise-ap-auth deployment:

env:
  - name: WAIT_FOR_IT
    value: '<posgres>:5432'
  - name: DB_USER
    value: <postgres-account>
  - name: DB_PASSWORD
    value: <password>
  - name: DB_ADDR
    value: <postgres>

Connecting to external Redis

To connect to your external redis instance:

  1. Open your anaconda-enterprise-anaconda-platform.yml file and edit the following section:

    redis:
      url: redis://<IP/Hostname>
      stream: operations
      consumer-group: default
      read-timeout: 30000
    
  2. Save your changes, then restart all pods:

    kubectl get pods | grep ap- | cut -d' ' -f1 | xargs kubectl delete pods
    

Note

Optionally, you can connect to rediss for TLS connection through port 6379.


You have successfully connected to your external Postgres redis! To verify your connection, create a new project and start a new session.