Deploy Postgres HA on Rancher Part 2
After we successfully deployed postgres ha, we will deploy pgadmin4 to test connection on our postgres ha cluster. In this part, we will deploy pgadmin4 and set nginx reverse proxy to access pgadmin. My worknode don’t have public IP, so I use nginx reverse proxy. You can use Public IP and expose your NodePort to connect to you pgadmin page instead of my method.
First, Create folder on worknode machine and chmod 777 for folder you just created, we will create PV for pgadmin.
Add Persistent Volume
Add New Catalog for pgadmin. Catalog URL is https://helm.runix.net
Launch pgadmin4
You must select the same namespace as the one postgres ha run. In part 1, we use pg-ha namespace.
We want to access pgadmin from outside container so we use node port to route it out of container. I set service type to NodePort, set port, set email and password for login to pgadmin page.
If everything goes well, you will see this.
Next, we will set up nginx reverse proxy by access machine with public ip in the same network. This machine must have docker install.
Create file /apps/nginx/nginx.conf as follow
Server name is your public ip or url of your server. proxy_pass is internal ip of your worknode machine.
Run docker command as follow. Allow your firewall for port 8080.
docker run -d — name reverseproxy -v /apps/nginx/:/etc/nginx/ -p 8080:8080 nginx
Open your browser with your public ip:8080
login with client@example.local / password
Create Server to connect to postgres ha.
Set the name you want.
Set connection
Host name: postgresql-ha-pgpool
Port: 5432
Maintenance database: postgres
Username: postgres
Password: password
You will see postgres database and repmgr in the list.