isabel obregon
07/11/2023, 9:03 PMMarvin
07/11/2023, 9:04 PMKubernetesJob
task, which requires kubectl
to be available. You must configure remote storage as local storage is not supported for Kubernetes. The ephemeral Prefect API won't work with Docker and Kubernetes, so you must have a Prefect server or Prefect Cloud API endpoint set in your agent's configuration. The Prefect CLI command prefect kubernetes manifest server
automatically generates a Kubernetes manifest with default settings for Prefect deployments. You can pipe this output to a file of your choice and edit as necessary. More details can be found in the Prefect documentation.
For creating a Kubernetes Secret for the API Key, you can follow the steps outlined in the Prefect Helm Worker guide. This guide also provides steps for adding the Prefect Helm repository to your Helm client, creating a namespace for the Prefect worker, and installing the Prefect worker using the Helm chart.
Remember, the devil is in the details. Make sure to read through the documentation thoroughly to avoid any unexpected surprises. After all, we wouldn't want your migration to be more of a headache than it needs to be, would we?Nate
07/11/2023, 9:07 PMNate
07/11/2023, 9:15 PMprefect init
- choose an infra / storage combo and check out the `prefect.yaml`and read more hereisabel obregon
07/11/2023, 9:19 PMNate
07/11/2023, 9:25 PMdocker-desktop
❯ k config get-contexts
all
your
k8s
contexts
e.g.
docker-desktop
❯ k config set-context --current --namespace=test
Context "docker-desktop" modified.
and now when you do all the helm
commands here, the installation will take place in this contextNate
07/11/2023, 9:26 PMkubectl
aliased to k
hahaNate
07/11/2023, 9:29 PMisabel obregon
07/11/2023, 10:02 PMNate
07/11/2023, 10:02 PMKiley Roberson
07/11/2023, 10:16 PMNate
07/11/2023, 10:31 PMprefect.blocks.system.Secret
(e.g. like this or in UI) to save secrets in cloud and access them wherever via the block SDK (i.e. my_block = Secret.load("my-block-name")
)
b. you can put environment variables as JSON in the env
field of your work pool, and you can override that env
on a deployment-basis if you desire (first pic)
c. you can also avoid specifying any secrets in prefect, and define pull
step in your prefect.yaml
that modifies the env
of the pod created by worker for a given flow run (docs) - for example, you could define a run_shell_script
step in your pull
section that fetches secrets from an external keyvault for whatever purpose you need
2. source code is an easier story
a. if you want to keep code in a git-like env (my personal recommendation bc its going to be there anyways!) then you just define a pull
step like this that will git_clone
your flow code to your pod at runtime
b. if you're going to use GCS or some other blob storage for code storage, you'd need to define a push
and pull
step like this but for GCSNate
07/11/2023, 10:32 PMpull
step is how your worker fetches your code at runtime (imo use git unless you can't 🙂 )Kiley Roberson
07/11/2023, 10:34 PMNate
07/11/2023, 10:34 PMNate
07/11/2023, 10:41 PMprefect.yaml
setup
• run prefect init
from project root and select docker-git
(for docker build
step and git pull
step) to get boilerplate for your setup