I'm getting a request error when I try to `prefect...
# prefect-community
a
I'm getting a request error when I try to
prefect auth login -t my_generated_token
Copy code
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <http://localhost:4200/graphql/alpha>
has anyone else ran into this? The server start up brought up all services just fine.
j
Hey @Adisun Wheelock you only have to call login when using Prefect Cloud 😄
a
yeah i was playing around with prefect cloud lol. More specifically i want to test out prefect kubernetes integration.
I saw a lot of the kubernetes operators required prefect cloud. Did i interpret that wrong?
j
Awesome! You can easily switch between using Cloud and the Core server as your backend by running:
Copy code
$ prefect backend server
OR
$ prefect backend cloud
a
ahh ok thanks!
j
Hmm which operators are you referring to?
a
sorry, i think i read tasks incorrectly.
i'm actually referring to this tutorial
and saw the
Cloud
tag.
j
Oh that should be updated thanks for pointing that out! The warning should be updated to match the one on here https://docs.prefect.io/orchestration/agents/kubernetes.html
a
there we go, thank you!
@josh do I need to use prefect cloud if i want to integrate kubernetes and prefect? The document you sent keeps referring to prefect cloud and im seeing this in my pod logs
prefect.utilities.exceptions.AuthorizationError: Provided token does not have a RUNNER scope.
j
By pod logs do you mean the k8s agent or a flow using k8s?
a
and running this
prefect auth create-token -n my-runner-token -r RUNNER
i get error
Copy code
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <https://api.prefect.io/graphql/alpha>
no i mean
kubectl logs pod-name
j
Did you log in to cloud prior to trying to create that token?
With
prefect auth login
a
i did yeah that worked
but looks like i dont need cloud? I was just able to get it to work but going thru the tutorial again
i exported my token, so i think i got myself into a state where kubernetes tried using that token.
j
Ah that could do it. You don’t need cloud per se but if you are using the Core server then you have to host it somewhere where Kubernetes can access the endpoint
a
i'm getting an API token not found error in the agent pod logs now 😕
j
Not found when trying to use the agent against the core server or against cloud?
a
core server. i ran this command
Copy code
prefect agent install kubernetes | kubectl apply -f -
j
Yeah I know why this isn’t working. There isn’t a way to actually set the backend on that command! I’m working on a PR now to fix that. In the meantime you should take the output of the
prefect agent install kubernetes
command and add the following env var:
Copy code
- name: PREFECT__BACKEND
  value: "server"