[AIRFLOW-1517] started documentation of k8s operator
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/12b725df Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/12b725df Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/12b725df Branch: refs/heads/master Commit: 12b725df154e28511edaa85074614c8974175b0d Parents: 28d9d7f Author: Daniel Imberman <[email protected]> Authored: Tue Jan 2 09:22:57 2018 -0800 Committer: Daniel Imberman <[email protected]> Committed: Thu Jan 11 15:29:17 2018 -0800 ---------------------------------------------------------------------- docs/kubernetes.rst | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/12b725df/docs/kubernetes.rst ---------------------------------------------------------------------- diff --git a/docs/kubernetes.rst b/docs/kubernetes.rst new file mode 100644 index 0000000..8d57028 --- /dev/null +++ b/docs/kubernetes.rst @@ -0,0 +1,36 @@ +Kubernetes Operator +========= + + + +.. code:: python + + from airflow.comtrib.operators import KubernetesOperator + k = KubernetesPodOperator(namespace='default', + image="ubuntu:16.04", + cmds=["bash", "-cx"], + arguments=["echo", "10"], + labels={"foo": "bar"}, + name="test", + task_id="task" + ) + + + ++--------------+----------------------------------------------------------------+---------------+ +| name | description | ++==============+================================================================+===============+ +| ``@namespace`` | The namespace is your isolated work environment within kubernetes| ++--------------+----------------------------------------------------------------+---------------+ +| ``@image`` | docker image you wish to launch. Defaults to dockerhub.io, but fully qualified URLS will point to custom repositories | ++--------------+----------------------------------------------------------------+---------------+ +| ``@cmnds`` | To start a task in a docker image, we need to tell it what to do. the cmds array is the space seperated bash command that will define the task completed by the container | ++--------------+----------------------------------------------------------------+---------------+ +| ``arguments`` | arguments for your bash command | ++--------------+----------------------------------------------------------------+---------------+ +| ``@labels`` | Labels are an important element of launching kubernetes pods, as it tells +| | kubernetes what pods a service can route to. For example, if you launch 5 postgres pods with the label {'postgres':'foo'} | +| | and create a postgres service with the same label, kubernetes will know that any time that service is queried, it can pick any of those 5 postgres instances as the endpoint for that service. | ++--------------+----------------------------------------------------------------+---------------+ +| ``@name`` | name of the task you want to run, will be used to generate a pod id | ++--------------+----------------------------------------------------------------+---------------+
