Hi just moving this over from the wrong channel: ...
# ask-community
c
Hi just moving this over from the wrong channel: I recently finished porting one of our pipelines over to prefect and have been eager to move out of local and over to an EKS/ECR configuration. I saw some guides by Anna and Jimmy that were really helpful so far, but I've hit multiple collisions and was seeking some help to work through some of them. Specifically two blockages I've encountered involve using our own custom base image, which is hosted on ECR, which is actually pulling code from CodeArtifact; that approach is hitting healthcheck issues when building. Another issue I'm having is being unable to create new EKS clusters through eksctl (where CloudFormation spits out max # of elastic IPs reached) , but I'm assuming that's more of a provisioning/permissioning issue and for that I'm just wondering if anyone else has gotten stuck at these points as well. I can however deploy an EKS Agent and view it in kubectl get pods, and publish a flow on Prefect Cloud regardless of these blockers, so I feel like I'm tangled up in the last few steps in getting this to work. (Thanks Dylan for pointing me to this channel!)
m
Hello Charles! šŸ‘‹ Can you share more information about healthcheck issue you are facing (any errors, logs, etc). Also, there is a limit set by AWS for Elastic IPs (5 IPs per account), but you can submit a request for Elastic IPs to Amazon.
c
So looking closer at the healthcheck it's actually erroring out when attempting to run "aws codeartifact login"; perhaps I'm implementing awscli incorrectly?
the image is able to build locally, and I've pushed it from Docker Desktop to ECR, but when trying to call it in a flow it healthchecks
I will reach out to AWS about elastic IPs thank you!
My intention is to run tasks in a docker base image that contains both Prefect (to talk to Prefect Cloud) and our private repo so that we can run in-house dependencies in our flows, and I guess I'm stuck on how to hook that up properly.
I suppose I have a better worded version of my question now: I have a prepped Docker Image that has the dependencies I need, and I've verified this by running python within the container. I've pushed that Image to ECR; The pipeline I've ported needs to run with those exact dependencies in a container to function properly. I would like to be able to run this flow anytime using an EKS agent and the image on ECR. Is declaring the following: • Storage = Docker() and • Run_config = KubernetesRun(), and then with • Flow(storage=Storage, run_config=Run_config) as flow: supposed to work?
m
Hi Charles!
aws codeartifact login
probably complains because AWS credentials are not configured properly (sorry, I'm not codeartifact expert). And yes, you're right, basic template looks like this:
Copy code
from prefect.storage import Docker
from prefect.run_configs import KubernetesRun
from prefect import task, Flow
import prefect

STORAGE = Docker(
    registry_url="<>.dkr.ecr.<>.<http://amazonaws.com|amazonaws.com>",
    image_name="<>",
    python_dependencies=["<>"],
)

RUN_CONFIG = KubernetesRun()

@task
def print_me():
    pass

with Flow(
    "ecs-with-ecr-example", storage=STORAGE, run_config=RUN_CONFIG
) as flow:
    print_me()

flow.register(project_name="<>")
šŸ™Œ 1
c
So when I try to pass ECSRun(), it says run_config only supports KubernetesRun(); any idea what that means? As in, the flow will not deploy when I use ECSRun as the run_config while running a Kubernetes Agent.
m
I apologize, misread ECS as EKS. You need to use KubernetesRun instead ECSRun šŸ™‚
c
Alright i'm going to give it a whirl and report back thank you!
m
Sounds good!
c
So I (think) i got one successful dummy run (saw a resource spike on EC2 and also my print statement in Prefect logs) but no more after that
I got my print statement, and now it's throwing a Forbidden error in all runs after that successful one, but I can kubectl get pods or nodes no problems