Hello Prefect users, I’m using a kubernetes agent ...
# prefect-community
n
Hello Prefect users, I’m using a kubernetes agent that is up and running on our cluster with our runner token no problem, and it is connected to our prefect server cloud backend with a healthy status code. However, Flows that I have registered are not being scheduled (aka late). Here is my flow code. Am I missing something here?
Copy code
from prefect import task, Flow, Parameter
from prefect import Client
@task(log_stdout=True)
def say_hello(name):
    print("Hello, {}!".format(name))
    return True
@task
def print_completed(status):
    if status:
        print('Success')
with Flow("Simple-Flow") as flow:
    name = Parameter('name')
    task1 = say_hello(name)
    print_completed(task1)
client = Client()
flow.register(project_name="Hello K8s")
c
Hey Noah! It appears you are registering your flow with default settings. This means that your Flow artifact is being stored on your local hard drive, which is inaccessible to your k8s agent. More specifically, when using local storage, Prefect auto-labels your flow with the label of your machine’s hostname. Because your K8s agent doesn’t have any labels (by default), it is not even attempting to run your flow. (Agents must have all the labels of your flow in order to run it). In this case, to fix your issue you’ll need to configure your flow to be stored using Docker storage; check out the deployment tutorial here for more info: https://docs.prefect.io/orchestration/tutorial/docker.html
n
@Chris White This makes much more sense, thank you!
c
anytime!