https://prefect.io logo
Title
b

Blue Radar

04/21/2023, 2:33 PM
Hello everyone, Facing an issue in launching agent in the Kubernetes deployment. I have created the work pool and work queue in my prefect UI. Able to launch agent in my local machine by pointing to the a work pool and work queue that agent is getting started perfectly.
prefect agent start -p <WORK_POOL> --api <WORK_SPACE_API>
But when i try to do the same in the Kubernetes deployment it is not working.
โœ… 1
r

Ryan Peden

04/21/2023, 2:48 PM
It looks like the agent running in K8s trying to connect to an ephemeral Prefect instance. Did you set
PREFECT_API_URL
and
PREFECT_API_KEY
in the agent's container?
b

Blue Radar

04/21/2023, 2:49 PM
yes, I did set
PREFECT_API_URL
and
PREFECT_API_KEY
in the agentโ€™s container
r

Ryan Peden

04/21/2023, 2:57 PM
In that case, I recommend double checking to ensure those environment variables are available inside the container. The behavior you're seeing is what happens if
PREFECT_API_URL
is not set. I just removed my
PREFECT_API_URL
and tried to start an agent and got this:
prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url '<http://ephemeral-prefect/api/work_pools/test_work_pool/get_scheduled_flow_runs>'
Response: {'detail': 'Work pool "test_work_pool" not found.'}
For more information check: <https://httpstatuses.com/404>
An exception occurred.
b

Blue Radar

04/21/2023, 3:09 PM
Now I am getting an another follow up error.
r

Ryan Peden

04/21/2023, 3:19 PM
At least it's trying to connect to your cloud workspace now ๐Ÿ™‚ It looks like there might be a typo in your API URL; I believe it should be
/api/accounts
, not
/api/account
b

Blue Radar

04/21/2023, 3:32 PM
@Ryan Peden , Now the agent is up and running in the k8s You did a great help in identifying this silly issue or silly mistake I made. Thank you sooooo much. ๐Ÿ‘๐Ÿ˜Š
r

Ryan Peden

04/21/2023, 7:16 PM
You're welcome! I'm happy your agent is running in k8s now ๐Ÿ˜„