https://flyte.org logo
#ask-the-community
Title
# ask-the-community
c

Carsten Klaus

08/02/2023, 2:38 PM
Hello Flyte community 🙂 TLDR: Is it possible to set
imagePullPolicy=Always
for task pods?
I have a question regarding task pods. We recently encountered the problem that a certain package was not installed in our custom task image, however we could clearly see that the package has been installed. We did a little research and recognized that the task pod has
imagePullPolicy: IfNotPresent
.
So our Kubernetes cluster took the image from the internal cache and thus took the "old" one. We need to overcome this problem. We installed flyte via
helm
with a custom
values.yaml
. Can we set the task imagePullPolicy somewhere to Always? Is there any other way to enforce a fresh image pull each time?
k

Ketan (kumare3)

08/02/2023, 2:47 PM
You can override any default behavior using pod templates
But some hooks are available for global defaults in propeller confit
c

Carsten Klaus

08/03/2023, 2:08 PM
@Ketan (kumare3) For both options I dont know where to start. Can you give me a hint
k

Ketan (kumare3)

08/04/2023, 1:06 AM
@Carsten Klaus yes will do, but @David Espejo (he/him) can you point to the config?
d

David Espejo (he/him)

08/04/2023, 12:34 PM
@Carsten Klaus as of now,
ImagePullPolicy
is not configurable from the Helm chart. Nevertheless, Flyte provides a native mechanism to modify this type of Pod-level parameters: PodTemplate You can either define a global PodTemplate or even declare one inline per-task: https://docs.flyte.org/en/latest/deployment/configuration/general.html#using-k8s-podtemplates Please let us know if it answers your question
p

Pryce

08/14/2023, 4:54 PM
Chiming in since I do this...
Copy code
from flytekit.core.pod_template import PodTemplate
from kubernetes.client.models import V1PodSpec, V1Volume, V1Container, V1VolumeMount, V1EnvVar, V1PersistentVolumeClaimVolumeSource

ps = V1PodSpec(
    containers=[
        V1Container(
            name='primary',
            image='<http://docker.io/rwgrim/docker-noop|docker.io/rwgrim/docker-noop>',
            image_pull_policy='Always',
                )
            ]
        )
    ]
)
Copy code
@task(task_config=Pod(pod_spec=ps))
def always_pull_task():
    ...
2 Views