<p>I want to create a deployment kubernetes instead of a pod. Is there a way to do it in apache airflow? . I know about the KubernetesPodOperator, but I want the kind : Deployment and not as kind: Pod.</p>

<p>KubernetesPodOperator in Apache Airflow</p>

<pre><code>k = KubernetesPodOperator(namespace='default',
                          image="ubuntu:16.04",
                          cmds=["bash", "-cx"],
                          arguments=["echo", "10"],
                          labels={"foo": "bar"},
                          secrets=[secret_file,secret_env]
                          volume=[volume],
                          volume_mounts=[volume_mount]
                          name="test",
                          task_id="task",
                          affinity=affinity,
                          is_delete_operator_pod=True,
                          hostnetwork=False,
                          tolerations=tolerations
                          )
</code></pre>

<p>Thanks</p>

Deep Patel
<blockquote>
  <p>I want to create a deployment kubernetes instead of a pod. Is there a way to do it in apache airflow?</p>
</blockquote>

<p>Not really. <a href="https://airflow.apache.org/" rel="nofollow noreferrer">Apache Airflow</a> is a tool to run batch tasks defined in a <a href="https://airflow.apache.org/concepts.html" rel="nofollow noreferrer">DAG</a> which does not fit the pattern of running the workload in a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">Kubernetes Deployment</a>. A Deployment is meant for long-running services type of applications that don't terminate unless there's a crash or you explicitly terminate/delete it (aka, generally stateless microservices)</p>

<p>The controller in Kubernetes that fits more with what Apache Airflow does is the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" rel="nofollow noreferrer">Job</a> controller which also creates a Pod when it runs. But that's where Airflow provides a richer feature set of features like support for <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="nofollow noreferrer">DAGs</a> </p>

<p>In summary, having the ability to create a Deployment using Airflow is more a nice to have, but doesn't necessarily fit into the tool's main pattern usage. I suggest using a different tool/method to create your deployments.</p>
