This is more of a Kubernetes question, but perhaps...
# ask-the-community
d
This is more of a Kubernetes question, but perhaps folks can help. Does anyone have an example of using V1PersistentVolumeClaimVolumeSource to bind a PVC to a Flyte task?
s
Should be doable with pod templates or the pod plugin. I don't have a concrete example but here's one I could find:
Copy code
@task(
   task_config=Pod(
       pod_spec=V1PodSpec(
           containers=[
               V1Container(
                   name="primary",
                   command=["/bin/sh"],
                   resources=V1ResourceRequirements(
                       requests={"cpu": "1", "memory": "500Mi"},
                       limits={"cpu": "1", "memory": "500Mi"},
                   ),
                   volume_mounts=[
                       V1VolumeMount(name="persistent-storage", mount_path="/data")
                   ],
               )
           ],
           volumes=[
               V1Volume(
                   name="persistent-storage",
                   persistent_volume_claim=V1PersistentVolumeClaimVolumeSource(
                       claim_name="fsx-claim"
                   ),
               )
           ],
       ),
       primary_container_name="primary",
   ),
   requests=Resources(
       mem="1Gi",
   ),
)
def my_pod_task() -> FlyteFile:
    ...
d
Thank you! Yes I figured it out in the end with something very similar to this