<p>I'm trying to run an Airflow task through Google Cloud Composer with the KubernetesPodOperator in an environment built from an image in a private Google Container Registry. The Container Registry and Cloud Composer instances are under the same project and everything worked fine until I updated the image the DAG refers too.</p>
<p>When I update the image in the Container Registry, Cloud Composer keeps using a stale image.</p>
<p>Concretely, in the code below</p>
<pre><code>import datetime
import airflow
from airflow.contrib.operators import kubernetes_pod_operator


YESTERDAY = datetime.datetime.now() - datetime.timedelta(days=1)


# Create Airflow DAG the the pipeline
with airflow.DAG(
        'my_dag',
        schedule_interval=datetime.timedelta(days=1),
        start_date=YESTERDAY) as dag:

    my_task = kubernetes_pod_operator.KubernetesPodOperator(
        task_id='my_task',
        name='my_task',
        cmds=['echo 0'],
        namespace='default',
        image=f'gcr.io/&lt;my_private_repository&gt;/&lt;my_image&gt;:latest')
</code></pre>
<p>if I update the image <code>gcr.io/&lt;my_private_repository&gt;/&lt;my_image&gt;:latest</code> in the Container Registry, Cloud Composer keeps using the stale image that is not present anymore in the Container Registry and throws an error.</p>
<p>Is this a bug?</p>
<p>Thanks a lot!</p>

Théophile Gervet
<p>As mentioned in the <a href="http://airflow.apache.org/docs/stable/_api/airflow/contrib/operators/kubernetes_pod_operator/index.html#module-contents" rel="nofollow noreferrer">documentation for <code>KubernetesPodOperator</code></a>, the default value for <code>image_pull_policy</code> is <code>'IfNotPresent'</code>. You need to configure your Pod Spec to pull image image always.</p>
<p>Simplest way to do it is setting the <code>image_pull_policy</code> to <code>'Always'</code>.</p>
<p>Few more ways are mentioned in <a href="https://kubernetes.io/docs/concepts/containers/images/#updating-images" rel="nofollow noreferrer">K8s Container Images documentation</a>.</p>
