A Kubernetes volume makes storage available inside a pod’s containers. A PersistentVolume provides storage, and a PersistentVolumeClaim requests it; pods can use the claim to store task results. Mounting the volume makes that storage accessible at a path in the container. section 11.5.2 section 11.5.1
Passing task data through a mounted volume
In a MovieLens workflow, one KubernetesPodOperator task writes fetched ratings to /data/ratings, and a later task reads them from the same mounted volume to produce rankings. section 11.5.3
Listing 11.24 Volumes and volume mounts
from kubernetes.client import models as k8s
...
volume_claim = k8s.V1PersistentVolumeClaimVolumeSource( #1
claim_name="data-volume"
)
volume = k8s.V1Volume( #2
name="data-volume",
persistent_volume_claim=volume_claim
)
volume_mount = k8s.V1VolumeMount(
name="data-volume",
mount_path="/data", #3
sub_path=None,
read_only=False, #4
)
See how a persistent volume claim is referenced by a V1Volume and mounted at /data with a V1VolumeMount. section 11.5.3







