Hello Flyte community :slightly_smiling_face: *TL...
# ask-the-community
c
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
You can override any default behavior using pod templates
But some hooks are available for global defaults in propeller confit
c
@Ketan (kumare3) For both options I dont know where to start. Can you give me a hint
k
@Carsten Klaus yes will do, but @David Espejo (he/him) can you point to the config?
d
@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
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():
    ...