Enabling external access to the internal PostgreSQL database

If you plan to install DevOps Plan using the internal PostgreSQL database and need to access it through the DevOps Plan Designer or other supported PostgreSQL tools, such as pgAdmin 4, you must enable external PostgreSQL access and configure the exposed port during installation or upgrade. in the helm install or helm upgrade command.

Procedure

  1. Enable PostgreSQL access in the helm install or helm upgrade command.
    --set postgresql.enableExternalAccess=true 
    --set postgresql.service.exposePort=30106
    --set control.postgresql.port=30106
    On Azure Kubernetes Service (AKS) and Alazon Elastic Kubernetes Service (EKS), the external IP address is not the same as the Kubernetes node IP. You must explicitly provide the node's internal IP address when running helm install or helm upgrade.
    1. Retrieve the node internal IP address.
      NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
    2. Pass the node IP to Helm by using the following option in your helm install or helm upgrade command .
      --set postgresql.service.ipAddress=${NODE_IP}
    On Google Kubernetes Engine (GKS), PostgreSQL must be exposed by using a LoadBalancer Service to obtain a public IP address. The external IP is assigned asynchronously after the service is created.
    1. Include the following option in your helm install or helm upgrade command.
      --set postgresql.service.cloudType=GKE
    2. Wait for the PostgreSQL service to get an EXTERNAL-IP.
      kubectl get svc devopsplan-postgresql -n devopsplan
    3. When you see an IP address under EXTERNAL-IP, capture it.
      PG_IP=$(kubectl get svc devopsplan-postgresql -n devopsplan \
        -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
    4. Upgrade the Helm release and inject the external IP.
      helm upgrade hcl-devopsplan . \
        --namespace devopsplan \
        ...
        ...
        --set postgresql.service.ipAddress=${PG_IP}
  2. After enabling external access, run the follwing command to view the PostgreSQL connection details that are required to connect to the database.
    helm status <release-name>

    This output includes the host, port, and other configuration variables needed to connect to the internal PostgreSQL instance.

    Host
    Use global.domain if using an Emissary-ingress Load Balancer.
    Use the VM IP address if installing on a local Kubernetes cluster.
    Port
    Use the value of postgresql.service.exposePort. The default value is 30106.
    Database
    postgres
    Username
    postgres
    Password
    To retrieve the password, run the following command, ensuring that the namespace is set to devopsplan.
    kubectl get secret --namespace devopsplan devopsplan-postgresql -o jsonpath="{.data.tenant-datastore-password}" | base64 -d; echo 
  3. To retrieve connection details from the DevOps Plan user interface, perform the following steps.
    1. Open the Tenant Management page.
    2. Select the desired tenant.
    3. From the TeamSpace panel, select Details.
    4. Click Show connection properties.
    5. View the PostgreSQL connection details for the selected Tenant TeamSpace.