Documentation Index
Fetch the complete documentation index at: https://astronomer-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Run the current Airflow image
You can run your Deployment’s current Airflow image with the KubernetesPodOperator by using the environment variable,ASTRONOMER_AIRFLOW_IMAGE. This environment variable allows you to run KPO tasks using the same Runtime image that your Deployment uses, in a way that won’t be affected by underlying cluster infrastructure changes that might change the base image repository URL. The ASTRONOMER_AIRFLOW_IMAGE environment variable allows you to ensure that your Deployment retrieves the correct image URL.
Setup
import os
from airflow.configuration import conf
from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator
from kubernetes.client import models as k8s
KubernetesPodOperator(
namespace=conf.get("kubernetes", "NAMESPACE"),
image=os.getenv("ASTRONOMER_AIRFLOW_IMAGE"),
image_pull_secrets=[
k8s.V1LocalObjectReference("image-pull-secret"),
k8s.V1LocalObjectReference("per-dp-registry-pull-secret"),
],
cmds=["<commands-for-image>"],
arguments=["<arguments-for-image>"],
labels={"<pod-label>": "<label-name>"},
name="<pod-name>",
task_id="<task-name>",
get_logs=True,
in_cluster=True,
)