Joseph Oladokun
11/15/2021, 11:34 AMAnna Geller
Joseph Oladokun
11/15/2021, 12:15 PMJoseph Oladokun
11/15/2021, 12:16 PMJoseph Oladokun
11/15/2021, 12:16 PMAnna Geller
Joseph Oladokun
11/15/2021, 12:25 PMluke b
11/25/2021, 5:31 PMAnna Geller
pip install prefect && prefect version
The same with kubectl: to run it, you would need to install kubectl first (here is install command for Mac, on Linux, checkout this):
brew install kubectl && kubectl version --client
However, I didn’t understand what problem would this solve. Can you explain your use case a bit more?
One thing that confused me for example is that you reference this EKS article which is all about a fully managed Kubernetes cluster with no EC2 instances that you would have to manage. Why are you setting up an EC2 instance? You could follow this tutorial entirely from your local machine.
Also regarding this:
That way I can call the ec2_setup.py local flow in my CI/CD pipeline to set up the eks systemYou don’t need to redeploy your Prefect agent every time within your CI/CD. The agent must be configured only once (e.g.
prefect agent kubernetes start --label your-agent-label
), after that you only need to register your flows while making sure that your flow is configured to be picked up by this agent through matching labels on the run configuration. Here is a small example (note that we use the same label for the agent startup command and flow):
with Flow(
"eks-flow",
storage=set_storage(FLOW_NAME),
run_config=KubernetesRun(labels=["your-agent-label"]),
) as flow:
task1() # all your tasks here
flow.register(project="your-project")
Do you want to have a Kubernetes agent or a local agent running on EC2?luke b
11/28/2021, 6:14 PMprefect agent install kubernetes -t <MyEKS_on_Fargate_K8s_Token> --rbac | kubectl apply -f -
How does the agent it know to send flows to the EKS cluster that was just spun up? Is it because the cluster info is in the kube config?
I didn’t see a prefect agent kubernetes start
command in the tutorial. Would I run this after installing the agent, as above?Anna Geller
prefect agent kubernetes install -k <API_KEY> --rbac >> k8s_agent.yaml
b) apply:
kubectl apply -f k8s_agent.yaml
Note that tokens are deprecated (-t
option in your command). I’d recommend checking out the latest documentation rather than this medium post because many things have changed since then. E.g., you should use API keys now rather than API tokens. Here is KubernetesAgent documentation that will explain it better: https://docs.prefect.io/orchestration/agents/kubernetes.html#requirementsluke b
11/29/2021, 4:54 PM