Hendrik
01/04/2024, 12:10 PMexec /usr/bin/tini: exec format error
error when running the deployment. Any Ideas how to resolve this? Things I checked:
• I figured that this might be due to building the image for the wrong platform and thus added the platform key:value to my prefect.yaml (see below).
• I also double checked my build image using docker inspect
to double check this actually worked (building the image for linux/amd64
• I checked the k8s nodes architecture which is also linux/amd64 using kubectl describe node <node-name>
Here’s my prefect.yaml:
# 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.
name: flows
prefect-version: 2.14.11
# 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: my.private.registry/image:tag
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: k8s-test-deployment
version:
tags: []
description:
schedule:
entrypoint: prefect_k8s_flow.py:hello
parameters: {}
work_pool:
name: k8s-worker-test
work_queue_name:
job_variables:
image: '{{ build_image.image }}'
Hendrik
01/04/2024, 3:31 PMauto
to Dockerfile
, which is a file that I created that fits my needs to run the flow. I am not setting the platform in the Dockerfile but in the prefect.yaml.
2. After that I had an issue with the working directory in the pull step. Executing the flow would note that the working dir /opt/prefect/flows
would not exist. After figuring out that prefect uses os.chdir(directory) using the provided directory I needed to wrap it in quotes ('/opt/prefect/flows'
instead of /opt/prefect/flows
) in order to successfully run my flow on k8s.
Here’s my updated prefect.yaml in case somebody needs it for reference.
# 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: flows
prefect-version: 2.14.11
# 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: my.private.registry/image:tag
tag: amd64-latest
dockerfile: Dockerfile
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: k8s-test-deployment
version:
tags: []
description:
schedule:
entrypoint: prefect_k8s_flow.py:hello
parameters: {}
work_pool:
name: k8s-worker-test
work_queue_name:
job_variables:
image: '{{ build_image.image }}'
I can now see my flow running fine 🙂