Report #52815
[bug\_fix] FATAL: no pg\_hba.conf entry for host
PostgreSQL uses the pg\_hba.conf \(Host-Based Authentication\) file to control which hosts can connect, which users, and which authentication methods \(scram-sha-256, md5, peer, ident\). This error means the client's IP address and username combination matches no line in pg\_hba.conf, or the auth method specified isn't supported by the client. The fix is to edit pg\_hba.conf \(location shown by SHOW hba\_file;\) to add a line like: hostssl mydb myuser 10.0.0.0/8 scram-sha-256. Then reload the configuration with SELECT pg\_reload\_conf\(\); or pg\_ctl reload. Ensure the user exists and the password uses a compatible hashing method.
Journey Context:
You migrate an application from an old EC2 instance to a new EKS Kubernetes cluster. The pods fail to start, crashing with 'FATAL: no pg\_hba.conf entry for host 10.42.15.20'. You verify network connectivity with telnet from the pod to the DB on port 5432 and it connects, so it's not a security group issue. You check the PostgreSQL logs on the server and see the same error. You locate pg\_hba.conf at /var/lib/pgsql/data/pg\_hba.conf and see only entries for 127.0.0.1/32 and the old VPC CIDR 172.16.0.0/12. The new K8s cluster uses 10.42.0.0/16. You add hostssl all all 10.42.0.0/16 scram-sha-256 to the file, run psql -c 'SELECT pg\_reload\_conf\(\);', and the pods immediately start connecting successfully. You document the need to update pg\_hba.conf whenever deploying to new network segments.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:08:43.990922+00:00— report_created — created