For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
      • AstroFully-managed data operations, powered by Apache Airflow.
      • Astro Private CloudRun Airflow-as-a-service in your environment.
      • Professional ServicesExpert Airflow services for your enterprise's success.
    • Tools
      • Cosmos
      • Orbiter
      • CLI
      • AI SDK
      • Agents
      • Blueprint
      • UpdatesThe State of Airflow 2026See the insights from over 5,800 data practitioners in the full report. Download Now ➔
  • Customers
  • Docs
    • Insights
      • Blog
      • Webinars
      • Resource Library
      • Events
    • Education
      • Academy
      • What is Airflow?
  • Pricing
Get Started Free
    • Overview
      • Overview
        • Set up KubernetesPodOperator
        • Configure task-level resources
        • Mount a temporary directory
        • Run your Deployment's current Airflow image
        • Use secret environment variables
        • Use the @task.kubernetes decorator
      • Dag versioning
      • Airflow logs
      • DAG and task runs
      • Airflow REST API
    • Book Office Hours

Product

  • Platform Overview
  • Astro
  • Astro Observe
  • Astro Private Cloud
  • Security & Trust
  • Pricing

Tools & Services

  • Cosmos
  • Docs
  • Professional Services
  • Product Updates

Use Cases

  • AI Ops
  • Data Observability
  • ETL/ELT
  • ML Ops
  • Operational Analytics
  • All Use Cases

Industries

  • Financial Services
  • Gaming
  • Retail
  • Manufacturing
  • Healthcare
  • All Industries

Resources

  • Academy
  • eBooks & Guides
  • Blog
  • Webinars
  • Events
  • The Data Flowcast Podcast
  • All Resources

Airflow

  • What is Airflow
  • Airflow on Astro
  • Airflow 3.0
  • Airflow Upgrades
  • Airflow Use Cases
  • Airflow 2.x End of Life

Company

  • Our Story
  • Customers
  • Newsroom
  • Careers
  • Contact

Support

  • Knowledge Base
  • Status
  • Contact Support
GitHubYouTubeLinkedInx
  • Legal
  • Privacy
  • Terms of Service
  • Consent Preferences

  • Do Not Sell or Share My Personal information
  • Limit the Use Of My Sensitive Personal Information

Apache Airflow®, Airflow, and the Airflow logo are trademarks of the Apache Software Foundation. Copyright © Astronomer 2026. All rights reserved.

LogoLogo
On this page
  • Prerequisites
  • Setup
Develop DAGsKubernetesPodOperator

Mount temporary directory

Edit this page
Built with

You can run a task run the KubernetesPodOperator that uses your Deployment’s ephemeral storage, mount an emptyDir volume to the KubernetesPodOperator.

Prerequisites

  • Set up the KubernetesPodOperator on Astro.

Setup

1

Mount an emptyDir volume

Add the following code example to your KubernetesPodOperator configuration.

1from airflow.configuration import conf
2from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator
3from kubernetes.client import models as k8s
4
5volume = k8s.V1Volume(
6 name="cache-volume",
7 emptyDir={},
8)
9
10volume_mounts = [
11 k8s.V1VolumeMount(
12 mount_path="/cache", name="cache-volume"
13 )
14]
15
16example_volume_test = KubernetesPodOperator(
17 namespace=namespace,
18 image="<your-docker-image>",
19 cmds=["<commands-for-image>"],
20 arguments=["<arguments-for-image>"],
21 labels={"<pod-label>": "<label-name>"},
22 name="<pod-name>",
23 task_id="<task-name>",
24 get_logs=True,
25 in_cluster=True,
26 volume_mounts=volume_mounts,
27 volumes=[volume],
28)