https://prefect.io logo
Title
a

Adisun Wheelock

05/04/2020, 1:16 PM
I'm getting a request error when I try to
prefect auth login -t my_generated_token
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

josh

05/04/2020, 1:17 PM
Hey @Adisun Wheelock you only have to call login when using Prefect Cloud 😄
a

Adisun Wheelock

05/04/2020, 1:17 PM
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

josh

05/04/2020, 1:18 PM
Awesome! You can easily switch between using Cloud and the Core server as your backend by running:
$ prefect backend server
OR
$ prefect backend cloud
a

Adisun Wheelock

05/04/2020, 1:18 PM
ahh ok thanks!
j

josh

05/04/2020, 1:19 PM
Hmm which operators are you referring to?
a

Adisun Wheelock

05/04/2020, 1:23 PM
sorry, i think i read tasks incorrectly.
i'm actually referring to this tutorial
and saw the
Cloud
tag.
j

josh

05/04/2020, 1:23 PM
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

Adisun Wheelock

05/04/2020, 1:24 PM
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

josh

05/04/2020, 2:24 PM
By pod logs do you mean the k8s agent or a flow using k8s?
a

Adisun Wheelock

05/04/2020, 2:24 PM
and running this
prefect auth create-token -n my-runner-token -r RUNNER
i get error
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <https://api.prefect.io/graphql/alpha>
no i mean
kubectl logs pod-name
j

josh

05/04/2020, 2:25 PM
Did you log in to cloud prior to trying to create that token?
With
prefect auth login
a

Adisun Wheelock

05/04/2020, 2:27 PM
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

josh

05/04/2020, 2:30 PM
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

Adisun Wheelock

05/04/2020, 2:30 PM
i'm getting an API token not found error in the agent pod logs now 😕
j

josh

05/04/2020, 2:31 PM
Not found when trying to use the agent against the core server or against cloud?
a

Adisun Wheelock

05/04/2020, 2:33 PM
core server. i ran this command
prefect agent install kubernetes | kubectl apply -f -
j

josh

05/04/2020, 2:34 PM
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:
- name: PREFECT__BACKEND
  value: "server"