Hi, I am trying to run a `KubernetesAgent` locally...
# ask-community
v
Hi, I am trying to run a
KubernetesAgent
locally and to bind it to minikube for testing purposes. For now, I see the Agent in the Server UI, but the tasks are not executed. How do I configure this? Thank you for you patience, I am new to Prefect.
Copy code
šŸ˜„  minikube v1.26.1 on Ubuntu 20.04
✨  Using the docker driver based on existing profile
šŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
šŸƒ  Updating the running docker "minikube" container ...
🐳  Preparing Kubernetes v1.24.3 on Docker 20.10.17 ...
    ā–Ŗ Generating certificates and keys ...
    ā–Ŗ Booting up control plane ...
    ā–Ŗ Configuring RBAC rules ...
šŸ”Ž  Verifying Kubernetes components...
    ā–Ŗ Using image <http://gcr.io/k8s-minikube/storage-provisioner:v5|gcr.io/k8s-minikube/storage-provisioner:v5>
🌟  Enabled addons: storage-provisioner, default-storageclass
šŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
m
Hey @Vlad Tudor Are you seeing any of the flow runs in the work-queue/ui and what status are they showing up in? if not are you deploying the flows or just trying to run them locally and view them in the ui?
v
So, I start Minikube (output given above):
Copy code
minikube start
Then I run the Prefect server:
Copy code
prefect backend server
prefect server start
Finally I run this script:
Copy code
from prefect.agent.kubernetes import KubernetesAgent
from pipeline import prefect_tasks
import prefect

if __name__ == '__main__':
    client = prefect.Client()
    client.create_tenant('default')
    client.create_project(project_name="project")

    flow = prefect_tasks.build_flow()
    flow.register(project_name="project", labels=["development"], add_default_labels=False)

    agent = KubernetesAgent()
    agent.start()
I open my UI at
localhost:8080
and I find my
default
tennant, my
project
project and I also see the Agent. The Agent connects to Minikube (initially I forgit to run minikube and a Connection Error was raised), the task gets submitted to the Agent, but nothing is run.