Hmm, I thought I had everything setup properly, bu...
# ask-community
a
Hmm, I thought I had everything setup properly, but apparently I was wrong. I am getting constant restarts in the prefect container with the following error:
ConnectionRefusedError: [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:
Copy code
kubectl exec -it -n test-client prefect-server-6888d4cbf8-6fcm8 -- /bin/bash
and then:
Copy code
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!
Here is the full error log with stacktrace
So i'm even more confused now. I am able to create a test variable, and I can see it in the database. So database connection from the server is 'working'. I am still having my server container restart when I get that error (pretty constantly). The UI stays up for a min or two, I can make changes in the UI, and then it restarts with that error above.
Yeah... I spent another two hours trying to debug this morning with no luck. It is failing when trying to apply migrations on startup. No idea why only that is having issues.