Connect to a Keycloak securised Prefect api url with Prefect CLI

85 Views Asked by At

I've built my own gke cluster to run jobs on it

I've deployed prefect-server, let's say on https://prefect.my-site.com/

but since it has no authentification system, i've deployed keycloak on top of it to login securely to manage my jobs

So when if you go to https://prefect.my-site.com/ you'll be redirected to https://keycloak.my-site.com/ to authentificate (and then be redirected)

Now I want to deploy prefect flows (my jobs) using the prefect CLI

The problem is the prefect CLI is needing the PREFECT_API_URL which is https://prefect.my-site.com/api but since it is securised, it is bloked on my keycloak url

prefect.exceptions.PrefectHTTPStatusError: Client error '415 Unsupported Media Type' for url 'https://keycloak.my-site.io/auth/realms/master/protocol/openid-connect/auth?client_id=prefect-server&redirect_uri=https%3A%2F%2Fprefect.my-site.io%2Foauth%2Fcallback&response_type=code&scope=openid+email+profile&state=XXX'
Response: {'error': 'RESTEASY003065: Cannot consume content type'}

I'm searching a way to authentificate with prefect CLI

I've tryed to connect with the keycloak CLI before running prefect CLI, but it is not working either...

Someone have a clue ? Thanks

0

There are 0 best solutions below