Hi, I’m trying to deploy Prefect 2.0 on k8s (EKS) ...
# prefect-server
m
Hi, I’m trying to deploy Prefect 2.0 on k8s (EKS) using the default manifest provided by
prefect kubernetes manifest orion
and I’m facing some issues with the UI which seems to not be able to connect to the database (it’s empty). It’s a similar issue to this one but on k8s, not locally. The agent container communicates with the server container (API) just fine and is able to pick up flows. I’m also able to connect to the API via prefect CLI on my local machine, create work queues, deployments, trigger flows etc (which are then picked up by the k8s agent). But UI is empty and I’m not able to see/create e.g. worker queues. Any idea what I might be missing?
1
a
Yup, what's missing is starting Orion: prefect orion start
z
If you’re running the API in a container, you don’t need to run it again locally. You’ll need to set the
PREFECT_API_URL
locally and the
PREFECT_ORION_UI_API_URL
in the container. These values should match.
The
PREFECT_ORION_UI_API_URL
tells the UI where to have clients (e.g. your web browser) make API requests to.
a
Thanks Michael. I had a similar issue when I haven't started Orion but started the UI separately in development mode 😄
z
Ah yeah that'd do it too :)
m
thanks both for the replies! but now I’m even more confused 😅 so I use this rendered template which to my understanding creates a single pod with two containers, one running the API, UI, db altogether, exposed as a k8s service on port 4200, and another container running an agent, pointing to that service via
PREFECT_API_URL
. I then set
PREFECT_API_URL
inside my local
~/.prefect/profiles.toml
(default profile) to
PREFECT_API_URL = "http://<POD-IP>:4200/api"
and this seems to be enough to query the API to create/get work queues, log flow runs, create deployments etc. When I open the same exact URL in my browser, I see prefect UI but there’s no data in there. Are you saying I also need to set
PREFECT_ORION_UI_API_URL
inside the
api
container? Isn’t it set to
PREFECT_API_URL
by default? (and
PREFECT_API_URL
by default is set to local inside the API container). To clarify, I do not interact with my local
orion.db
at all (in fact I deleted it from
~/.prefect
, so it doesn’t even exist), just the db running inside the pod
prefect orion start
locally does help in the sense that I’m able to interact with the k8s api at
127.0.0.1:4200
but obviously I’d like to do it directly at
<POD-IP>:4200
without running a server locally
z
Are you saying I also need to set
PREFECT_ORION_UI_API_URL
inside the
api
container?
Yes, to the URL that users of the UI need to make API requests. This is because the requests to the API come from the user’s browser, not local to the UI pod.
We need to update the manifest to include a command to set that variable, the manifest command was written before the UI supported non-local connections.
m
🙏 thanks! all clear now, added the external URL to the api env and the UI is working now
🙌 1