Hi everyone,
I deployed my Flask web application inside a Kubernetes cluster using a Deployment and a ClusterIP Service.
The application connects to a PostgreSQL database, which is also deployed in the same cluster as a separate Pod with its own ClusterIP service.
However, when I try to access the app, I get this error in the logs:
psycopg2.OperationalError: could not connect to server: Connection refused
My environment variable DB_HOST
is set to postgres-service
.
Both services and pods are running in the same namespace
Here’s what I’ve already checked:
- Both Pods are running
- Services are correctly named
- The port exposed by the PostgreSQL service is 5432
Is there anything else I should verify?
Thanks in advance!