Adam Brusselback
02/04/2025, 2:33 AMConnectionRefusedError: [Errno 111] Connect call failed ('10.43.121.165', 5432)
The error is happening when trying to run migrations on startup.
That is the correct internal cluster IP that it resolved to (I used the hostname in the connectionstring). I also did some tests to make sure that the container should be able to connect:
kubectl exec -it -n test-client prefect-server-6888d4cbf8-6fcm8 -- /bin/bash
and then:
python3 -c '
import asyncio
from sqlalchemy.ext.asyncio import create_async_engine
async def test_sqlalchemy():
try:
engine = create_async_engine("<postgresql+asyncpg://app:mypassword@goacquire-cluster-prefect-rw:5432/app>")
async with engine.connect() as conn:
print("SQLAlchemy connection successful!")
except Exception as e:
print(f"SQLAlchemy Error: {e}")
asyncio.run(test_sqlalchemy())
'
which returned Successfully connected!
Adam Brusselback
02/04/2025, 2:36 AMAdam Brusselback
02/04/2025, 3:18 AMAdam Brusselback
02/04/2025, 2:42 PMAdam Brusselback
02/04/2025, 6:07 PM