<p dir="auto"><strong>Description</strong><br>
I would like to improve the DAG deprecation warning for duplicate task ids to include the dag_id</p>
<p dir="auto"><strong>Use case / motivation</strong><br>
I would like the error message to include the dag_id, so I can more easily locate the issue</p>
<p dir="auto">Here's an example of the existing message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/usr/local/lib/python3.7/site-packages/airflow/models/dag.py:1342: PendingDeprecationWarning: The requested task could not be added to the DAG because a task with task_id end_placement_perf is already in the DAG. Starting in Airflow 2.0, trying to overwrite a task will raise an exception.
  category=PendingDeprecationWarning)"><pre class="notranslate"><code class="notranslate">/usr/local/lib/python3.7/site-packages/airflow/models/dag.py:1342: PendingDeprecationWarning: The requested task could not be added to the DAG because a task with task_id end_placement_perf is already in the DAG. Starting in Airflow 2.0, trying to overwrite a task will raise an exception.
  category=PendingDeprecationWarning)
</code></pre></div>
<p dir="auto">After seeing this message, I know the problematic task, but not the problematic DAG. We have lots of DAGs, so I still have to do some more searching to find what I need to fix.</p>
<p dir="auto">Here's the message I would like to see:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/usr/local/lib/python3.7/site-packages/airflow/models/dag.py:1342: PendingDeprecationWarning: The requested task could not be added to the DAG with dag_id my_dag_id because a task with task_id end_placement_perf is already in the DAG. Starting in Airflow 2.0, trying to overwrite a task will raise an exception.
  category=PendingDeprecationWarning)"><pre class="notranslate"><code class="notranslate">/usr/local/lib/python3.7/site-packages/airflow/models/dag.py:1342: PendingDeprecationWarning: The requested task could not be added to the DAG with dag_id my_dag_id because a task with task_id end_placement_perf is already in the DAG. Starting in Airflow 2.0, trying to overwrite a task will raise an exception.
  category=PendingDeprecationWarning)
</code></pre></div>
<p dir="auto"><strong>Related Issues</strong><br>
I couldn't find one</p>
<p dir="auto"><strong>Apache Airflow version</strong>: 1.10.12rc1</p>
<p dir="auto"><strong>Kubernetes version (if you are using kubernetes)</strong> (use <code class="notranslate">kubectl version</code>): v1.16.11-gke.5</p>
<p dir="auto"><strong>Environment</strong>:</p>
<p dir="auto">I am using the official docker image with the helm chart in this repo (with really minor tweaks). Config is pretty close to default.<br>
Docker image: <code class="notranslate">apache/airflow:v1-10-test-python3.8</code> (exact: <code class="notranslate">apache/airflow@sha256:53ac5c6f7df40c886cd1918f40d7802fd57e90f60cfaacc9c66f1f0f56890af4</code>)</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>: /</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): /</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): /</li>
<li><strong>Install tools</strong>: /</li>
<li><strong>Others</strong>: /</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto">Using the KubernetesPodOperator with one or more secrets with mount type <code class="notranslate">volume</code> leads to incorrect pod configuration with duplicated volumes and <code class="notranslate">mountPath</code> ; and as a result the pod is not schedulable.</p>
<p dir="auto"><code class="notranslate">HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Pod \"airflow-test-pod-88c703e254004b26b008f9a7f63e1349\" is invalid: spec.containers[0].volumeMounts[1].mountPath: Invalid value: \"/var/location\": must be unique","reason":"Invalid","details":{"name":"airflow-test-pod-88c703e254004b26b008f9a7f63e1349","kind":"Pod","causes":[{"reason":"FieldValueInvalid","message":"Invalid value: \"/var/location\": must be unique","field":"spec.containers[0].volumeMounts[1].mountPath"}]},"code":422}</code></p>
<p dir="auto">(full log is available below)</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto">To produce the correct pod configuration. Something like:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;apiVersion&quot;: &quot;v1&quot;,
  &quot;kind&quot;: &quot;Pod&quot;,
  &quot;metadata&quot;: {
    &quot;labels&quot;: {
      &quot;airflow_version&quot;: &quot;1.10.12&quot;,
      &quot;kubernetes_pod_operator&quot;: &quot;True&quot;,
      &quot;dag_id&quot;: &quot;bug_secret&quot;,
      &quot;task_id&quot;: &quot;task&quot;,
      &quot;execution_date&quot;: &quot;2020-08-17T115046.6768040000-0d7e92426&quot;,
      &quot;try_number&quot;: &quot;2&quot;
    },
    &quot;name&quot;: &quot;airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce&quot;,
    &quot;namespace&quot;: &quot;airflow&quot;
  },
  &quot;spec&quot;: {
    &quot;affinity&quot;: {},
    &quot;containers&quot;: [
      {
        &quot;args&quot;: [
          &quot;echo&quot;,
          &quot;10&quot;
        ],
        &quot;command&quot;: [
          &quot;bash&quot;,
          &quot;-cx&quot;
        ],
        &quot;env&quot;: [],
        &quot;image&quot;: &quot;ubuntu:16.04&quot;,
        &quot;imagePullPolicy&quot;: &quot;IfNotPresent&quot;,
        &quot;name&quot;: &quot;base&quot;,
        &quot;resources&quot;: {
          &quot;limits&quot;: {},
          &quot;requests&quot;: {}
        },
        &quot;volumeMounts&quot;: [
          {
            &quot;mountPath&quot;: &quot;/var/location&quot;,
            &quot;name&quot;: &quot;secretvold175d8b5-89b6-4ed4-957b-ff997a029463&quot;,
            &quot;readOnly&quot;: true
          }
        ]
      }
    ],
    &quot;hostNetwork&quot;: false,
    &quot;imagePullSecrets&quot;: [],
    &quot;initContainers&quot;: [],
    &quot;restartPolicy&quot;: &quot;Never&quot;,
    &quot;securityContext&quot;: {},
    &quot;serviceAccountName&quot;: &quot;default&quot;,
    &quot;tolerations&quot;: [],
    &quot;volumes&quot;: [
      {
        &quot;name&quot;: &quot;secretvold175d8b5-89b6-4ed4-957b-ff997a029463&quot;,
        &quot;secret&quot;: {
          &quot;secretName&quot;: &quot;my-secret&quot;
        }
      }
    ]
  }
}"><pre class="notranslate">{
  <span class="pl-ent">"apiVersion"</span>: <span class="pl-s"><span class="pl-pds">"</span>v1<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"kind"</span>: <span class="pl-s"><span class="pl-pds">"</span>Pod<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"metadata"</span>: {
    <span class="pl-ent">"labels"</span>: {
      <span class="pl-ent">"airflow_version"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.10.12<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"kubernetes_pod_operator"</span>: <span class="pl-s"><span class="pl-pds">"</span>True<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"dag_id"</span>: <span class="pl-s"><span class="pl-pds">"</span>bug_secret<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"task_id"</span>: <span class="pl-s"><span class="pl-pds">"</span>task<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"execution_date"</span>: <span class="pl-s"><span class="pl-pds">"</span>2020-08-17T115046.6768040000-0d7e92426<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"try_number"</span>: <span class="pl-s"><span class="pl-pds">"</span>2<span class="pl-pds">"</span></span>
    },
    <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"namespace"</span>: <span class="pl-s"><span class="pl-pds">"</span>airflow<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"spec"</span>: {
    <span class="pl-ent">"affinity"</span>: {},
    <span class="pl-ent">"containers"</span>: [
      {
        <span class="pl-ent">"args"</span>: [
          <span class="pl-s"><span class="pl-pds">"</span>echo<span class="pl-pds">"</span></span>,
          <span class="pl-s"><span class="pl-pds">"</span>10<span class="pl-pds">"</span></span>
        ],
        <span class="pl-ent">"command"</span>: [
          <span class="pl-s"><span class="pl-pds">"</span>bash<span class="pl-pds">"</span></span>,
          <span class="pl-s"><span class="pl-pds">"</span>-cx<span class="pl-pds">"</span></span>
        ],
        <span class="pl-ent">"env"</span>: [],
        <span class="pl-ent">"image"</span>: <span class="pl-s"><span class="pl-pds">"</span>ubuntu:16.04<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"imagePullPolicy"</span>: <span class="pl-s"><span class="pl-pds">"</span>IfNotPresent<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>base<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"resources"</span>: {
          <span class="pl-ent">"limits"</span>: {},
          <span class="pl-ent">"requests"</span>: {}
        },
        <span class="pl-ent">"volumeMounts"</span>: [
          {
            <span class="pl-ent">"mountPath"</span>: <span class="pl-s"><span class="pl-pds">"</span>/var/location<span class="pl-pds">"</span></span>,
            <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>secretvold175d8b5-89b6-4ed4-957b-ff997a029463<span class="pl-pds">"</span></span>,
            <span class="pl-ent">"readOnly"</span>: <span class="pl-c1">true</span>
          }
        ]
      }
    ],
    <span class="pl-ent">"hostNetwork"</span>: <span class="pl-c1">false</span>,
    <span class="pl-ent">"imagePullSecrets"</span>: [],
    <span class="pl-ent">"initContainers"</span>: [],
    <span class="pl-ent">"restartPolicy"</span>: <span class="pl-s"><span class="pl-pds">"</span>Never<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"securityContext"</span>: {},
    <span class="pl-ent">"serviceAccountName"</span>: <span class="pl-s"><span class="pl-pds">"</span>default<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"tolerations"</span>: [],
    <span class="pl-ent">"volumes"</span>: [
      {
        <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>secretvold175d8b5-89b6-4ed4-957b-ff997a029463<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"secret"</span>: {
          <span class="pl-ent">"secretName"</span>: <span class="pl-s"><span class="pl-pds">"</span>my-secret<span class="pl-pds">"</span></span>
        }
      }
    ]
  }
}</pre></div>
<p dir="auto"><strong>How to reproduce it</strong>:</p>
<p dir="auto">Use this simple dag:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
from airflow.kubernetes.secret import Secret
from airflow.models import DAG
from airflow.utils.dates import days_ago


default_args = {
    'owner': 'Airflow',
    'start_date': days_ago(2)
}

with DAG(
    dag_id='bug_secret',
    default_args=default_args,
    schedule_interval=None
) as dag:
    k = KubernetesPodOperator(
        namespace='airflow',
        image=&quot;ubuntu:16.04&quot;,
        cmds=[&quot;bash&quot;, &quot;-cx&quot;],
        arguments=[&quot;echo&quot;, &quot;10&quot;],
        secrets=[Secret(
            deploy_type=&quot;volume&quot;,
            deploy_target=&quot;/var/location&quot;,
            secret=&quot;my-secret&quot;,
            key=&quot;content.json&quot;,
        )],
        name=&quot;airflow-test-pod&quot;,
        task_id=&quot;task&quot;,
        get_logs=True,
        is_delete_operator_pod=True,
    )"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">airflow</span>.<span class="pl-s1">contrib</span>.<span class="pl-s1">operators</span>.<span class="pl-s1">kubernetes_pod_operator</span> <span class="pl-k">import</span> <span class="pl-v">KubernetesPodOperator</span>
<span class="pl-k">from</span> <span class="pl-s1">airflow</span>.<span class="pl-s1">kubernetes</span>.<span class="pl-s1">secret</span> <span class="pl-k">import</span> <span class="pl-v">Secret</span>
<span class="pl-k">from</span> <span class="pl-s1">airflow</span>.<span class="pl-s1">models</span> <span class="pl-k">import</span> <span class="pl-v">DAG</span>
<span class="pl-k">from</span> <span class="pl-s1">airflow</span>.<span class="pl-s1">utils</span>.<span class="pl-s1">dates</span> <span class="pl-k">import</span> <span class="pl-s1">days_ago</span>


<span class="pl-s1">default_args</span> <span class="pl-c1">=</span> {
    <span class="pl-s">'owner'</span>: <span class="pl-s">'Airflow'</span>,
    <span class="pl-s">'start_date'</span>: <span class="pl-en">days_ago</span>(<span class="pl-c1">2</span>)
}

<span class="pl-k">with</span> <span class="pl-v">DAG</span>(
    <span class="pl-s1">dag_id</span><span class="pl-c1">=</span><span class="pl-s">'bug_secret'</span>,
    <span class="pl-s1">default_args</span><span class="pl-c1">=</span><span class="pl-s1">default_args</span>,
    <span class="pl-s1">schedule_interval</span><span class="pl-c1">=</span><span class="pl-c1">None</span>
) <span class="pl-k">as</span> <span class="pl-s1">dag</span>:
    <span class="pl-s1">k</span> <span class="pl-c1">=</span> <span class="pl-v">KubernetesPodOperator</span>(
        <span class="pl-s1">namespace</span><span class="pl-c1">=</span><span class="pl-s">'airflow'</span>,
        <span class="pl-s1">image</span><span class="pl-c1">=</span><span class="pl-s">"ubuntu:16.04"</span>,
        <span class="pl-s1">cmds</span><span class="pl-c1">=</span>[<span class="pl-s">"bash"</span>, <span class="pl-s">"-cx"</span>],
        <span class="pl-s1">arguments</span><span class="pl-c1">=</span>[<span class="pl-s">"echo"</span>, <span class="pl-s">"10"</span>],
        <span class="pl-s1">secrets</span><span class="pl-c1">=</span>[<span class="pl-v">Secret</span>(
            <span class="pl-s1">deploy_type</span><span class="pl-c1">=</span><span class="pl-s">"volume"</span>,
            <span class="pl-s1">deploy_target</span><span class="pl-c1">=</span><span class="pl-s">"/var/location"</span>,
            <span class="pl-s1">secret</span><span class="pl-c1">=</span><span class="pl-s">"my-secret"</span>,
            <span class="pl-s1">key</span><span class="pl-c1">=</span><span class="pl-s">"content.json"</span>,
        )],
        <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">"airflow-test-pod"</span>,
        <span class="pl-s1">task_id</span><span class="pl-c1">=</span><span class="pl-s">"task"</span>,
        <span class="pl-s1">get_logs</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">is_delete_operator_pod</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
    )</pre></div>
<p dir="auto"><strong>Anything else we need to know</strong>:</p>
<p dir="auto">On the one hand, if I had to guess, I'd say that the issues comes from this PR <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="670441525" data-permission-text="Title is private" data-url="https://github.com/apache/airflow/issues/10084" data-hovercard-type="pull_request" data-hovercard-url="/apache/airflow/pull/10084/hovercard" href="https://github.com/apache/airflow/pull/10084">#10084</a> . On the other hand, this feature seems to be unittested, so I don't really understand what is going on.</p>
<details><summary>Task execution logs</summary>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2020-08-17 11:52:57,525] {taskinstance.py:901} INFO - Executing &lt;Task(KubernetesPodOperator): task&gt; on 2020-08-17T11:50:46.676804+00:00
[2020-08-17 11:52:57,530] {standard_task_runner.py:54} INFO - Started process 3401 to run task
[2020-08-17 11:52:57,578] {standard_task_runner.py:77} INFO - Running: ['airflow', 'run', 'bug_secret', 'task', '2020-08-17T11:50:46.676804+00:00', '--job_id', '3', '--pool', 'default_pool', '--raw', '-sd', 'DAGS_FOLDER/bug_secret.py', '--cfg_path', '/tmp/tmp8motpeb_']
[2020-08-17 11:52:57,579] {standard_task_runner.py:78} INFO - Job 3: Subtask task
[2020-08-17 11:52:57,639] {logging_mixin.py:112} INFO - Running %s on host %s &lt;TaskInstance: bug_secret.task 2020-08-17T11:50:46.676804+00:00 [running]&gt; airflow-scheduler-0.airflow-scheduler.dev-airflow-helm.svc.cluster.local
[2020-08-17 11:52:57,789] {logging_mixin.py:112} WARNING - /home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py:309: DeprecationWarning: Using `airflow.contrib.kubernetes.pod.Pod` is deprecated. Please use `k8s.V1Pod`.
  dummy_pod = Pod(
[2020-08-17 11:52:57,789] {logging_mixin.py:112} WARNING - /home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py:77: DeprecationWarning: Using `airflow.contrib.kubernetes.pod.Pod` is deprecated. Please use `k8s.V1Pod` instead.
  pod = self._mutate_pod_backcompat(pod)
[2020-08-17 11:52:57,845] {pod_launcher.py:88} ERROR - Exception when attempting to create Namespaced Pod: {
  &quot;apiVersion&quot;: &quot;v1&quot;,
  &quot;kind&quot;: &quot;Pod&quot;,
  &quot;metadata&quot;: {
    &quot;labels&quot;: {
      &quot;airflow_version&quot;: &quot;1.10.12&quot;,
      &quot;kubernetes_pod_operator&quot;: &quot;True&quot;,
      &quot;dag_id&quot;: &quot;bug_secret&quot;,
      &quot;task_id&quot;: &quot;task&quot;,
      &quot;execution_date&quot;: &quot;2020-08-17T115046.6768040000-0d7e92426&quot;,
      &quot;try_number&quot;: &quot;2&quot;
    },
    &quot;name&quot;: &quot;airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce&quot;,
    &quot;namespace&quot;: &quot;airflow&quot;
  },
  &quot;spec&quot;: {
    &quot;affinity&quot;: {},
    &quot;containers&quot;: [
      {
        &quot;args&quot;: [
          &quot;echo&quot;,
          &quot;10&quot;
        ],
        &quot;command&quot;: [
          &quot;bash&quot;,
          &quot;-cx&quot;
        ],
        &quot;env&quot;: [],
        &quot;image&quot;: &quot;ubuntu:16.04&quot;,
        &quot;imagePullPolicy&quot;: &quot;IfNotPresent&quot;,
        &quot;name&quot;: &quot;base&quot;,
        &quot;resources&quot;: {
          &quot;limits&quot;: {},
          &quot;requests&quot;: {}
        },
        &quot;volumeMounts&quot;: [
          {
            &quot;mountPath&quot;: &quot;/var/location&quot;,
            &quot;name&quot;: &quot;secretvold175d8b5-89b6-4ed4-957b-ff997a029463&quot;,
            &quot;readOnly&quot;: true
          },
          {
            &quot;mountPath&quot;: &quot;/var/location&quot;,
            &quot;name&quot;: &quot;secretvole148d425-b284-410b-87b0-b0049fed1de5&quot;,
            &quot;readOnly&quot;: true
          }
        ]
      }
    ],
    &quot;hostNetwork&quot;: false,
    &quot;imagePullSecrets&quot;: [],
    &quot;initContainers&quot;: [],
    &quot;restartPolicy&quot;: &quot;Never&quot;,
    &quot;securityContext&quot;: {},
    &quot;serviceAccountName&quot;: &quot;default&quot;,
    &quot;tolerations&quot;: [],
    &quot;volumes&quot;: [
      {
        &quot;name&quot;: &quot;secretvold175d8b5-89b6-4ed4-957b-ff997a029463&quot;,
        &quot;secret&quot;: {
          &quot;secretName&quot;: &quot;my-secret&quot;
        }
      },
      {
        &quot;name&quot;: &quot;secretvole148d425-b284-410b-87b0-b0049fed1de5&quot;,
        &quot;secret&quot;: {
          &quot;secretName&quot;: &quot;secretvold175d8b5-89b6-4ed4-957b-ff997a029463&quot;
        }
      }
    ]
  }
}
Traceback (most recent call last):
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py&quot;, line 84, in run_pod_async
    resp = self._client.create_namespaced_pod(body=sanitized_pod,
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py&quot;, line 6174, in create_namespaced_pod
    (data) = self.create_namespaced_pod_with_http_info(namespace, body, **kwargs)  # noqa: E501
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py&quot;, line 6251, in create_namespaced_pod_with_http_info
    return self.api_client.call_api(
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 340, in call_api
    return self.__call_api(resource_path, method,
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 172, in __call_api
    response_data = self.request(
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 382, in request
    return self.rest_client.POST(url,
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/rest.py&quot;, line 272, in POST
    return self.request(&quot;POST&quot;, url,
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/rest.py&quot;, line 231, in request
    raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'fb7acb18-2ead-4c92-ac27-953133e57f83', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'Date': 'Mon, 17 Aug 2020 11:52:57 GMT', 'Content-Length': '518'})
HTTP response body: {&quot;kind&quot;:&quot;Status&quot;,&quot;apiVersion&quot;:&quot;v1&quot;,&quot;metadata&quot;:{},&quot;status&quot;:&quot;Failure&quot;,&quot;message&quot;:&quot;Pod \&quot;airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce\&quot; is invalid: spec.containers[0].volumeMounts[1].mountPath: Invalid value: \&quot;/var/location\&quot;: must be unique&quot;,&quot;reason&quot;:&quot;Invalid&quot;,&quot;details&quot;:{&quot;name&quot;:&quot;airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce&quot;,&quot;kind&quot;:&quot;Pod&quot;,&quot;causes&quot;:[{&quot;reason&quot;:&quot;FieldValueInvalid&quot;,&quot;message&quot;:&quot;Invalid value: \&quot;/var/location\&quot;: must be unique&quot;,&quot;field&quot;:&quot;spec.containers[0].volumeMounts[1].mountPath&quot;}]},&quot;code&quot;:422}


[2020-08-17 11:52:57,873] {taskinstance.py:1150} ERROR - (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'fb7acb18-2ead-4c92-ac27-953133e57f83', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'Date': 'Mon, 17 Aug 2020 11:52:57 GMT', 'Content-Length': '518'})
HTTP response body: {&quot;kind&quot;:&quot;Status&quot;,&quot;apiVersion&quot;:&quot;v1&quot;,&quot;metadata&quot;:{},&quot;status&quot;:&quot;Failure&quot;,&quot;message&quot;:&quot;Pod \&quot;airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce\&quot; is invalid: spec.containers[0].volumeMounts[1].mountPath: Invalid value: \&quot;/var/location\&quot;: must be unique&quot;,&quot;reason&quot;:&quot;Invalid&quot;,&quot;details&quot;:{&quot;name&quot;:&quot;airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce&quot;,&quot;kind&quot;:&quot;Pod&quot;,&quot;causes&quot;:[{&quot;reason&quot;:&quot;FieldValueInvalid&quot;,&quot;message&quot;:&quot;Invalid value: \&quot;/var/location\&quot;: must be unique&quot;,&quot;field&quot;:&quot;spec.containers[0].volumeMounts[1].mountPath&quot;}]},&quot;code&quot;:422}

Traceback (most recent call last):
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py&quot;, line 984, in _run_raw_task
    result = task_copy.execute(context=context)
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/airflow/contrib/operators/kubernetes_pod_operator.py&quot;, line 284, in execute
    final_state, _, result = self.create_new_pod_for_operator(labels, launcher)
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/airflow/contrib/operators/kubernetes_pod_operator.py&quot;, line 400, in create_new_pod_for_operator
    launcher.start_pod(
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py&quot;, line 135, in start_pod
    resp = self.run_pod_async(pod)
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py&quot;, line 90, in run_pod_async
    raise e
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py&quot;, line 84, in run_pod_async
    resp = self._client.create_namespaced_pod(body=sanitized_pod,
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py&quot;, line 6174, in create_namespaced_pod
    (data) = self.create_namespaced_pod_with_http_info(namespace, body, **kwargs)  # noqa: E501
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py&quot;, line 6251, in create_namespaced_pod_with_http_info
    return self.api_client.call_api(
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 340, in call_api
    return self.__call_api(resource_path, method,
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 172, in __call_api
    response_data = self.request(
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 382, in request
    return self.rest_client.POST(url,
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/rest.py&quot;, line 272, in POST
    return self.request(&quot;POST&quot;, url,
  File &quot;/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/rest.py&quot;, line 231, in request
    raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'fb7acb18-2ead-4c92-ac27-953133e57f83', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'Date': 'Mon, 17 Aug 2020 11:52:57 GMT', 'Content-Length': '518'})
HTTP response body: {&quot;kind&quot;:&quot;Status&quot;,&quot;apiVersion&quot;:&quot;v1&quot;,&quot;metadata&quot;:{},&quot;status&quot;:&quot;Failure&quot;,&quot;message&quot;:&quot;Pod \&quot;airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce\&quot; is invalid: spec.containers[0].volumeMounts[1].mountPath: Invalid value: \&quot;/var/location\&quot;: must be unique&quot;,&quot;reason&quot;:&quot;Invalid&quot;,&quot;details&quot;:{&quot;name&quot;:&quot;airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce&quot;,&quot;kind&quot;:&quot;Pod&quot;,&quot;causes&quot;:[{&quot;reason&quot;:&quot;FieldValueInvalid&quot;,&quot;message&quot;:&quot;Invalid value: \&quot;/var/location\&quot;: must be unique&quot;,&quot;field&quot;:&quot;spec.containers[0].volumeMounts[1].mountPath&quot;}]},&quot;code&quot;:422}"><pre class="notranslate"><code class="notranslate">[2020-08-17 11:52:57,525] {taskinstance.py:901} INFO - Executing &lt;Task(KubernetesPodOperator): task&gt; on 2020-08-17T11:50:46.676804+00:00
[2020-08-17 11:52:57,530] {standard_task_runner.py:54} INFO - Started process 3401 to run task
[2020-08-17 11:52:57,578] {standard_task_runner.py:77} INFO - Running: ['airflow', 'run', 'bug_secret', 'task', '2020-08-17T11:50:46.676804+00:00', '--job_id', '3', '--pool', 'default_pool', '--raw', '-sd', 'DAGS_FOLDER/bug_secret.py', '--cfg_path', '/tmp/tmp8motpeb_']
[2020-08-17 11:52:57,579] {standard_task_runner.py:78} INFO - Job 3: Subtask task
[2020-08-17 11:52:57,639] {logging_mixin.py:112} INFO - Running %s on host %s &lt;TaskInstance: bug_secret.task 2020-08-17T11:50:46.676804+00:00 [running]&gt; airflow-scheduler-0.airflow-scheduler.dev-airflow-helm.svc.cluster.local
[2020-08-17 11:52:57,789] {logging_mixin.py:112} WARNING - /home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py:309: DeprecationWarning: Using `airflow.contrib.kubernetes.pod.Pod` is deprecated. Please use `k8s.V1Pod`.
  dummy_pod = Pod(
[2020-08-17 11:52:57,789] {logging_mixin.py:112} WARNING - /home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py:77: DeprecationWarning: Using `airflow.contrib.kubernetes.pod.Pod` is deprecated. Please use `k8s.V1Pod` instead.
  pod = self._mutate_pod_backcompat(pod)
[2020-08-17 11:52:57,845] {pod_launcher.py:88} ERROR - Exception when attempting to create Namespaced Pod: {
  "apiVersion": "v1",
  "kind": "Pod",
  "metadata": {
    "labels": {
      "airflow_version": "1.10.12",
      "kubernetes_pod_operator": "True",
      "dag_id": "bug_secret",
      "task_id": "task",
      "execution_date": "2020-08-17T115046.6768040000-0d7e92426",
      "try_number": "2"
    },
    "name": "airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce",
    "namespace": "airflow"
  },
  "spec": {
    "affinity": {},
    "containers": [
      {
        "args": [
          "echo",
          "10"
        ],
        "command": [
          "bash",
          "-cx"
        ],
        "env": [],
        "image": "ubuntu:16.04",
        "imagePullPolicy": "IfNotPresent",
        "name": "base",
        "resources": {
          "limits": {},
          "requests": {}
        },
        "volumeMounts": [
          {
            "mountPath": "/var/location",
            "name": "secretvold175d8b5-89b6-4ed4-957b-ff997a029463",
            "readOnly": true
          },
          {
            "mountPath": "/var/location",
            "name": "secretvole148d425-b284-410b-87b0-b0049fed1de5",
            "readOnly": true
          }
        ]
      }
    ],
    "hostNetwork": false,
    "imagePullSecrets": [],
    "initContainers": [],
    "restartPolicy": "Never",
    "securityContext": {},
    "serviceAccountName": "default",
    "tolerations": [],
    "volumes": [
      {
        "name": "secretvold175d8b5-89b6-4ed4-957b-ff997a029463",
        "secret": {
          "secretName": "my-secret"
        }
      },
      {
        "name": "secretvole148d425-b284-410b-87b0-b0049fed1de5",
        "secret": {
          "secretName": "secretvold175d8b5-89b6-4ed4-957b-ff997a029463"
        }
      }
    ]
  }
}
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py", line 84, in run_pod_async
    resp = self._client.create_namespaced_pod(body=sanitized_pod,
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py", line 6174, in create_namespaced_pod
    (data) = self.create_namespaced_pod_with_http_info(namespace, body, **kwargs)  # noqa: E501
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py", line 6251, in create_namespaced_pod_with_http_info
    return self.api_client.call_api(
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 340, in call_api
    return self.__call_api(resource_path, method,
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 172, in __call_api
    response_data = self.request(
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 382, in request
    return self.rest_client.POST(url,
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 272, in POST
    return self.request("POST", url,
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 231, in request
    raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'fb7acb18-2ead-4c92-ac27-953133e57f83', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'Date': 'Mon, 17 Aug 2020 11:52:57 GMT', 'Content-Length': '518'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Pod \"airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce\" is invalid: spec.containers[0].volumeMounts[1].mountPath: Invalid value: \"/var/location\": must be unique","reason":"Invalid","details":{"name":"airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce","kind":"Pod","causes":[{"reason":"FieldValueInvalid","message":"Invalid value: \"/var/location\": must be unique","field":"spec.containers[0].volumeMounts[1].mountPath"}]},"code":422}


[2020-08-17 11:52:57,873] {taskinstance.py:1150} ERROR - (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'fb7acb18-2ead-4c92-ac27-953133e57f83', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'Date': 'Mon, 17 Aug 2020 11:52:57 GMT', 'Content-Length': '518'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Pod \"airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce\" is invalid: spec.containers[0].volumeMounts[1].mountPath: Invalid value: \"/var/location\": must be unique","reason":"Invalid","details":{"name":"airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce","kind":"Pod","causes":[{"reason":"FieldValueInvalid","message":"Invalid value: \"/var/location\": must be unique","field":"spec.containers[0].volumeMounts[1].mountPath"}]},"code":422}

Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 984, in _run_raw_task
    result = task_copy.execute(context=context)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/contrib/operators/kubernetes_pod_operator.py", line 284, in execute
    final_state, _, result = self.create_new_pod_for_operator(labels, launcher)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/contrib/operators/kubernetes_pod_operator.py", line 400, in create_new_pod_for_operator
    launcher.start_pod(
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py", line 135, in start_pod
    resp = self.run_pod_async(pod)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py", line 90, in run_pod_async
    raise e
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/pod_launcher.py", line 84, in run_pod_async
    resp = self._client.create_namespaced_pod(body=sanitized_pod,
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py", line 6174, in create_namespaced_pod
    (data) = self.create_namespaced_pod_with_http_info(namespace, body, **kwargs)  # noqa: E501
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py", line 6251, in create_namespaced_pod_with_http_info
    return self.api_client.call_api(
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 340, in call_api
    return self.__call_api(resource_path, method,
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 172, in __call_api
    response_data = self.request(
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 382, in request
    return self.rest_client.POST(url,
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 272, in POST
    return self.request("POST", url,
  File "/home/airflow/.local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 231, in request
    raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'fb7acb18-2ead-4c92-ac27-953133e57f83', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'Date': 'Mon, 17 Aug 2020 11:52:57 GMT', 'Content-Length': '518'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Pod \"airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce\" is invalid: spec.containers[0].volumeMounts[1].mountPath: Invalid value: \"/var/location\": must be unique","reason":"Invalid","details":{"name":"airflow-test-pod-151ddf3a60fc4cc4981d2390c4e4b4ce","kind":"Pod","causes":[{"reason":"FieldValueInvalid","message":"Invalid value: \"/var/location\": must be unique","field":"spec.containers[0].volumeMounts[1].mountPath"}]},"code":422}
</code></pre></div>
</details>