<p>I am using Airflow2.0 with <code>KubernetesPodOperator</code> want to run a command that use as a parameter a file from inside the image ran by the Operator. This is what I used:</p>
<pre><code>KubernetesPodOperator(
    namespace=commons.kubernetes_namespace,
    labels=commons.labels,
    image=f&quot;myregistry.io/myimage:{config['IMAGE_TAG']}&quot;,
    arguments=[
        &quot;python&quot;,
        &quot;run_module.py &quot;,
        &quot;-i&quot;,
        f'args/{config[&quot;INPUT_DIR&quot;]}/{task_id}.json'
    ],
    name=dag_name + task_id,
    task_id=task_id,
    secrets=[secret_volume]
)
</code></pre>
<p>But this gives me the error:</p>
<pre><code>raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: args/airflow2test/processing-pipeline.json
</code></pre>
<p>The image does not use any macros.</p>
<p>Anyone has any clue? What do I do wrong?</p>

salvob
<p>This was a bug that started with <a href="https://github.com/apache/airflow/pull/15942" rel="nofollow noreferrer">PR</a> released in version <code>2.0.0</code> of <a href="https://pypi.org/project/apache-airflow-providers-cncf-kubernetes/" rel="nofollow noreferrer"><code>apache-airflow-providers-cncf-kubernetes</code></a>.
The goal of the change was to allow templating of <code>.json</code> files. There was a <a href="https://github.com/apache/airflow/issues/16922" rel="nofollow noreferrer">GitHub issue</a> about the problems it created. The bug was eventually resolved by <a href="https://github.com/apache/airflow/pull/17760" rel="nofollow noreferrer">PR</a> which was released in version 2.0.2 of the provider.</p>
<p>Solution:</p>
<ol>
<li>Upgrade to the latest <code>apache-airflow-providers-cncf-kubernetes</code> (currently 2.0.2)</li>
<li>If upgrade is not an option use custom <code>KubernetesPodOperator</code></li>
</ol>
<p>There are two ways to workaround that problem one is to change <code>template_fields</code> the other is to change <code>template_ext</code>:</p>
<p>1st option: As posted on <a href="https://github.com/apache/airflow/issues/16922#issuecomment-892153152" rel="nofollow noreferrer">issue</a> by raphaelauv is not to allow rendering of <code>arguments</code> field:</p>
<pre><code>class MyKubernetesPodOperator(KubernetesPodOperator):
    template_fields = tuple(x for x in KubernetesPodOperator.template_fields if x != &quot;arguments&quot;)
</code></pre>
<p>2st option:  if you prefer not to render <code>.json</code> files:</p>
<pre><code>class MyKubernetesPodOperator(KubernetesPodOperator):
    template_ext = ('.yaml', '.yml',)
</code></pre>
