Skip to content

Connect Openshift database from local pgAdmin

MCatherine edited this page May 16, 2024 · 1 revision

Connect to the openshift database from local

  1. From local terminal, login to Openshift using oc command
  • To install the oc command line tool, you can download it from Openshift namespace
Screen Shot 2024-05-16 at 10 12 12 AM
  • To login, you can copy the login command from Openshift namespace
Screen Shot 2024-05-16 at 10 13 28 AM
  1. Run the following command in the terminal
# switch to the namespace
oc project [namespace]
# port forward the pod
oc port-forward [postgres-db-pod] 4200:5432
  1. Open the PgAdmin on the local
  • Right click on servers -> register -> server
Screen Shot 2024-05-16 at 10 16 04 AM
  • In the popup window, you can give any name you like. Under the connection tab:
    • hostname: you can find this from the terminal when you do port forwarding Screen Shot 2024-05-16 at 10 20 06 AM
    • port: 4200
    • username: the database username we used to login to FOM db
    • password: the database password, we can find from Openshift secrets
Screen Shot 2024-05-16 at 10 20 49 AM
  • Fill in the information and click save, the database should be added in pgAdmin
  1. Install PostGIS
  • Right click the new db you added -> select “Query Tool” and run: CREATE EXTENSION postgis;