<@ULVA73B9P> I just installed prefect on kuberenet...
# ask-marvin
h
@Marvin I just installed prefect on kuberenetes with helm on a selfhosted remote server. How to sent a flow to that prefect server
m
thought for 372.5 seconds
h
where is that tool
m
Great question — you’re almost there. In Prefect 3.x, “sending a flow” to your self-hosted Server means 1) pointing your local environment at that API, 2) creating a work pool, 3) running a worker that polls that pool, and 4) creating a deployment for your flow. Quick questions to tailor the steps: - Do you have only the Prefect Server/UI installed via Helm, or did you also install a Kubernetes worker? - What URL do you use to access your Prefect UI (e.g., https://prefect.example.com or http//&lt;ip&gt;4200)? Assuming you have only the Server/UI installed, here’s the minimal path: 1) Point your local Prefect to your remote Server - Set the API URL on your machine so CLI and Python calls talk to your server:
Copy code
prefect config set PREFECT_API_URL="http://<your-host-or-domain>:4200/api"
Docs: Self-hosted Server on Kubernetes (Helm) 2) Create a Kubernetes work pool (one-time)
Copy code
prefect work-pool create my-k8s --type kubernetes
Concepts: Work pools and Workers 3) Start a worker that polls that pool - Best practice: run the worker inside your cluster (via Helm). If you haven’t installed a worker yet, install the Prefect Kubernetes worker Helm chart and configure it with: - PREFECT_API_URL pointing to your server (e.g., http//&lt;host&gt;4200/api) - The work pool name you created (e.g., my-k8s) - Reference: Deploy a worker using Helm (Kubernetes) - For a quick test (with kubeconfig and permissions), you can also start a worker from your machine:
Copy code
prefect worker start -p my-k8s
4) Create and register a deployment for your flow Option A: Python API (works anywhere, minimal config)
Copy code
from prefect import flow
from prefect.flows import Flow

@flow
def my_flow():
    print("hello from k8s")

# Run this once to register the deployment with your server
deployment_id = Flow.from_source(
    source="<https://github.com/<owner>/<repo>>",
    entrypoint="flows/my_flow.py:my_flow",
).deploy(
    name="k8s",
    work_pool_name="my-k8s",
)

print("Deployment created:", deployment_id)
Option B: CLI from your project root (prefect.yaml-based) - From your project root, you can run:
Copy code
prefect deploy ./flows/my_flow.py:my_flow --name k8s
- If your project config doesn’t set a default work pool, the CLI will prompt you to choose one; select
my-k8s
. Docs: prefect.yaml and deployments 5) Trigger a run
Copy code
prefect deployment run "my_flow/k8s" --watch
You should see the flow run queuing in your Server UI and picked up by the worker. Troubleshooting checklist - If the run stays “Scheduled”: confirm a worker is running and polling the correct pool (
my-k8s
). - If you don’t see deployments: ensure
PREFECT_API_URL
is set both in your local env (for deploy) and in the worker environment (so it can talk to the server). - Networking: verify your Server’s API is reachable at
http(s)://<host-or-domain>:4200/api
(or your Ingress URL). For quick local access, you can also port-forward:
Copy code
kubectl -n <namespace> port-forward svc/prefect-server 4200:4200
If you share your Server URL and whether you’ve installed a worker already, I can provide an exact Helm values snippet for the worker to point at your server and pool.
h
how to authenticate to the repote server
how to aouthenticate