My Django app can't connect to the Postgres server on Kubernetes. All other pods are able to connect to this Postgres server and creds are valid as well, any idea why not this Django app
django.db.utils.OperationalError: could not connect to server: Connection timed out Is the server running on host "postgres-postgresql" (10.245.56.118) and accepting TCP/IP connections on port 5342?
Picture of the problem. I login into the django app container and tried to connect via Django's data access layer and psql. Only psql is working without any problems
postgres:
https://github.com/cetic/helm-postgresql
Kubernetes:
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
githubdir.service: valnet
name: valnet
spec:
selector:
matchLabels:
app: valnet
replicas: 1
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
app: valnet
spec:
containers:
- args:
env:
- name: VALNET_DATABASE_USER
value: "postgres"
- name: VALNET_DATABASE_PASSWORD
value: "gdrBP9xxDZ"
- name: VALNET_DATABASE_HOST
value: "postgres-postgresql"
- name: VALNET_DATABASE_PORT
value: "5342"
image: donutloop/valnet:v0.3.0
name: valnet
ports:
- containerPort: 8000
resources: {}
restartPolicy: Always
That chart configured Postgres to listen on port 5432. You tried to connect to port 5342. Those are different.