Hi
@Marvin,
I’ve been struggling for about 5 days now trying to run my Flows on K8 😢
I followed
this guide to the point. AKS Workpool is showing green and working (I can see my pods start).
Flows are working correctly locally but when running on the K8 worker, always fail with the same error
FileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/flows'
In my deployment YAML I’ve tried both options to build the docker file -
auto
and manually specifying it as below.
# Dockerfile
FROM prefecthq/prefect:2-python3.11
COPY requirements.txt .
RUN pip install -r requirements.txt --trusted-host <http://pypi.python.org|pypi.python.org> --no-cache-dir
ADD flows /opt/prefect/flows
I’ve also tried building the deployment using the CLI as well as Python methods
Deployment.build_from_flow
but to no avail.
The docker build and push to ACR are successful.
My
prefect.yaml
looks like this
# Welcome to your prefect.yaml file! You can use this file for storing and managing
# configuration for deploying your flows. We recommend committing this file to source
# control along with your flow code.
# Generic metadata about this project
name: prefect-example
prefect-version: 2.13.1
# build section allows you to manage and build docker images
build:
- prefect_docker.deployments.steps.build_docker_image:
id: build_image
requires: prefect-docker>=0.3.1
image_name: XYZ
tag: latest
dockerfile: auto
platform: "linux/amd64"
# push section allows you to manage if and how this project is uploaded to remote locations
push:
- prefect_docker.deployments.steps.push_docker_image:
requires: prefect-docker>=0.3.1
image_name: "{{ build_image.image_name }}"
tag: "{{ build_image.tag }}"
# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.set_working_directory:
directory: /opt/prefect/flows
# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: airbyte_syncs
version:
tags: []
description:
entrypoint: flows/XYZ.py:XYZ
parameters: {}
work_pool:
name: AKS Workpool
work_queue_name:
job_variables:
image: "{{ build_image.image }}"
schedule:
I’ve tried reading extensively through the forums, Slack, SO, Google, ChatGPT everything. But not sure why that path issue arises.
Can anyone help? Thanks in advance
thank you