Tom Jordahl
11/12/2024, 4:41 PMMarvin
11/12/2024, 4:41 PMrequirements.txt
file, allowing you to build a custom image if needed.
To deploy on Kubernetes, you don't usually need to specify any particular settings in the cluster configuration since the Prefect worker should already have appropriate access and permissions. However, if you are using a custom Dockerfile, you can specify its path using the DockerImage
class in your deployment settings. This allows further customization, such as installing private Python packages.
Make sure to set the PREFECT_API_URL
and PREFECT_API_KEY
in the environment where your worker is running.
For more details, you can check the Prefect documentation:
- Docker infrastructure examples: Docker Examples
- Kubernetes infrastructure examples: Kubernetes Examples
- Workers and infrastructure concepts: Infrastructure Concepts
And remember, while Prefect's tools are powerful, they don't quite understand the concept of "I forgot to build the Docker image" errors.Nate
11/12/2024, 4:52 PMFROM prefecthq/prefect:3.1.1-python3.12
COPY requirements.txt
RUN pip install -r requirements.txt
docker build -t something:latest
and push it somewhere
then set (either work pool or deployment or flow run)
job_variables=dict(image='something:latest')
Tom Jordahl
11/12/2024, 4:53 PM3-python3.10-kubernetes
assuming I needed a “kubernetes” imageNate
11/12/2024, 4:53 PMNate
11/12/2024, 4:54 PMTom Jordahl
11/12/2024, 4:54 PM3.1.1-python3.10
would lock me to 3.1.1Nate
11/12/2024, 4:54 PMTom Jordahl
11/12/2024, 4:54 PMNate
11/12/2024, 4:55 PMTom Jordahl
11/12/2024, 4:55 PM3-latest
for prefect server and 3-python3.11-kubernetes
for workerNate
11/12/2024, 4:55 PMTom Jordahl
11/12/2024, 4:55 PMTom Jordahl
11/12/2024, 4:56 PMNate
11/12/2024, 4:57 PMNate
11/12/2024, 4:58 PM