<p><em>&quot;When using the KubernetesExecutor, Airflow offers the ability to override system defaults on a per-task basis. To utilize this functionality, we can create a Kubernetes <code>V1pod</code> object and fill in the desired overrides.&quot;</em></p>
<p>I am trying to trigger a DAG with the following operator (example from the official core doc):</p>
<pre class="lang-py prettyprint-override"><code>...
volume_task = PythonOperator(
            task_id=&quot;task_with_volume&quot;,
            python_callable=test_volume_mount,
            executor_config={
                &quot;pod_override&quot;: k8s.V1Pod(
                    spec=k8s.V1PodSpec(
                        containers=[
                            k8s.V1Container(
                                name=&quot;base&quot;,
                                volume_mounts=[
                                    k8s.V1VolumeMount(
                                        mount_path=&quot;/foo/&quot;, name=&quot;example-kubernetes-test-volume&quot;
                                    )
                                ],
                            )
                        ],
                        volumes=[
                            k8s.V1Volume(
                                name=&quot;example-kubernetes-test-volume&quot;,
                                host_path=k8s.V1HostPathVolumeSource(path=&quot;/tmp/&quot;),
                            )
                        ],
                    )
                ),
            },
        )
...
</code></pre>
<p>When I click on my DAG in the UI, I got the following error:</p>
<pre><code>
                          ____/ (  (    )   )  \___
                         /( (  (  )   _    ))  )   )\
                       ((     (   )(    )  )   (   )  )
                     ((/  ( _(   )   (   _) ) (  () )  )
                    ( (  ( (_)   ((    (   )  .((_ ) .  )_
                   ( (  )    (      (  )    )   ) . ) (   )
                  (  (   (  (   ) (  _  ( _) ).  ) . ) ) ( )
                  ( (  (   ) (  )   (  ))     ) _)(   )  )  )
                 ( (  ( \ ) (    (_  ( ) ( )  )   ) )  )) ( )
                  (  (   (  (   (_ ( ) ( _    )  ) (  )  )   )
                 ( (  ( (  (  )     (_  )  ) )  _)   ) _( ( )
                  ((  (   )(    (     _    )   _) _(_ (  (_ )
                   (_((__(_(__(( ( ( |  ) ) ) )_))__))_)___)
                   ((__)        \\||lll|l||///          \_))
                            (   /(/ (  )  ) )\   )
                          (    ( ( ( | | ) ) )\   )
                           (   /(| / ( )) ) ) )) )
                         (     ( ((((_(|)_)))))     )
                          (      ||\(|(|)|/||     )
                        (        |(||(||)||||        )
                          (     //|/l|||)|\\ \     )
                        (/ / //  /|//||||\\  \ \  \ _)
-------------------------------------------------------------------------------
Node: 9c9de21b5ea0
-------------------------------------------------------------------------------
Traceback (most recent call last):
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/app.py&quot;, line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/app.py&quot;, line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/app.py&quot;, line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/_compat.py&quot;, line 39, in reraise
    raise value
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/app.py&quot;, line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/app.py&quot;, line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask_admin/base.py&quot;, line 69, in inner
    return self._run_view(f, *args, **kwargs)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask_admin/base.py&quot;, line 368, in _run_view
    return fn(self, *args, **kwargs)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask_login/utils.py&quot;, line 258, in decorated_view
    return func(*args, **kwargs)
  File &quot;/usr/local/lib/airflow/airflow/www/utils.py&quot;, line 386, in view_func
    return f(*args, **kwargs)
  File &quot;/usr/local/lib/airflow/airflow/www/utils.py&quot;, line 292, in wrapper
    return f(*args, **kwargs)
  File &quot;/usr/local/lib/airflow/airflow/utils/db.py&quot;, line 74, in wrapper
    return func(*args, **kwargs)
  File &quot;/usr/local/lib/airflow/airflow/www/views.py&quot;, line 1706, in tree
    show_external_logs=bool(external_logs))
  File &quot;/usr/local/lib/airflow/airflow/www/views.py&quot;, line 425, in render
    return super(AirflowViewMixin, self).render(template, **kwargs)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask_admin/base.py&quot;, line 308, in render
    return render_template(template, **kwargs)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/templating.py&quot;, line 140, in render_template
    ctx.app,
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/templating.py&quot;, line 120, in _render
    rv = template.render(context)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/jinja2/environment.py&quot;, line 1090, in render
    self.environment.handle_exception()
  File &quot;/opt/python3.6/lib/python3.6/site-packages/jinja2/environment.py&quot;, line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File &quot;/opt/python3.6/lib/python3.6/site-packages/jinja2/_compat.py&quot;, line 28, in reraise
    raise value.with_traceback(tb)
  File &quot;/usr/local/lib/airflow/airflow/www/templates/airflow/tree.html&quot;, line 20, in top-level template code
    {% extends &quot;airflow/dag.html&quot; %}
  File &quot;/usr/local/lib/airflow/airflow/www/templates/airflow/dag.html&quot;, line 21, in top-level template code
    {% import 'admin/lib.html' as lib with context %}
  File &quot;/usr/local/lib/airflow/airflow/www/templates/airflow/master.html&quot;, line 20, in top-level template code
    {% extends &quot;admin/master.html&quot; %}
  File &quot;/usr/local/lib/airflow/airflow/www/templates/admin/master.html&quot;, line 20, in top-level template code
    {% extends 'admin/base.html' %}
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask_admin/templates/bootstrap3/admin/base.html&quot;, line 95, in top-level template code
    {% block tail %}
  File &quot;/usr/local/lib/airflow/airflow/www/templates/airflow/tree.html&quot;, line 85, in block &quot;tail&quot;
    var data = {{ data|tojson }};
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/json/__init__.py&quot;, line 376, in tojson_filter
    return Markup(htmlsafe_dumps(obj, **kwargs))
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/json/__init__.py&quot;, line 290, in htmlsafe_dumps
    dumps(obj, **kwargs)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/json/__init__.py&quot;, line 211, in dumps
    rv = _json.dumps(obj, **kwargs)
  File &quot;/opt/python3.6/lib/python3.6/json/__init__.py&quot;, line 238, in dumps
    **kw).encode(obj)
  File &quot;/opt/python3.6/lib/python3.6/json/encoder.py&quot;, line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File &quot;/opt/python3.6/lib/python3.6/json/encoder.py&quot;, line 257, in iterencode
    return _iterencode(o, 0)
  File &quot;/opt/python3.6/lib/python3.6/site-packages/flask/json/__init__.py&quot;, line 100, in default
    return _json.JSONEncoder.default(self, o)
  File &quot;/opt/python3.6/lib/python3.6/json/encoder.py&quot;, line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'V1Pod' is not JSON serializable
</code></pre>
<p>Can you please tell me what is going on and how I can resolve the issue?
Thanks</p>

Pascal GILLET
<p>It's a bug which was fixed in Airflow 2.0.0 (See <a href="https://github.com/apache/airflow/pull/11952" rel="nofollow noreferrer">PR</a>)</p>
