Good day. I am running into some behavior with the...
# ask-community
j
Good day. I am running into some behavior with the prefect CLI that I do not understand. I have a profiles.toml with local, eks, and cloud entries. Even if I specify
prefect profile use 'eks'
or
prefect profile use 'local'
,
prefect deployment ls
returns the list of deployments from my cloud instance. This also occurs with
prefect -p 'eks' deployment ls
or
prefect -p 'local' deployment ls
.
prefect profile ls
shows all three profiles and shows 'eks' as the active profile. The deploy commands also seems stuck on the cloud profile. Any ideas what's going on?
Sadly, those were not helpful in the end. Even if I remove all the profiles except the one I want to connect to (not cloud) with the cli from profiles.toml, the prefect CLI is still showing me deployments from the cloud account. This Github issue is open but with a comment that it should be addressed by merged code so I am not sure what is going on. Any insights would be helpful. Thanks.
j
If you run
prefect profile create someprofile
That will create a new profile that can connect to your local sqlite backend. Then do
prefect profile use someprofile
to activate. Then
prefect server start
. Any deployments in the local db should then show up in the UI.
c
Another possibility could be that you have environment variables that are overriding your profiles (environment variables take precedence over profile settings); you should be able to check this quickly by running
env | grep PREFECT
j
Thank you both for responding. I have checked the environment variables and there are none related to PREFECT. The server I am trying to (re)connect the Prefect client to is running in a Kubernetes cluster that is accessible right now via forwarding port 4200 to a high number port on my local machine. The contents of the profile therefore look like
Copy code
active = "eks"

[profiles.eks]
PREFECT_SERVER_API_HOST = "127.0.0.1"
PREFECT_SERVER_API_PORT = "43654"
with
Copy code
kubectl port-forward svc/prefect-server -n prefect-dev 43654:4200
running in the background. I can connect to the Prefect server dashboard in a web browser through the ingress configured on the cluster (and this method shows a server with access to the API) and also through the forwarded port on localhost (though the localhost relay does not access the API* but I wouldn't expect that since the API should be accessible only to the server except on the forwarded port). Do I need to be forwarding additional ports from my cluster to my local environment for the local client to work? I don't remember needing to do this for setting up previous deployments in the kube deployment but I might be forgetting something, of course.
Copy code
Pop-up when visiting the remote server dashboard through on the forwarded port, i.e. :
Can't connect to Server API at <https://zzz.yyy.com/api>. Check that it's accessible from your machine.
FWIW,
prefect deployment ls
does work as expected when I add
PREFECT_API_URL = "<http://127.0.0.1:43654/api>"
to profiles.toml so it seems like specifying the server and port are not sufficient, even though that provides the components for the API URL.