| 1 |
Kubernetes |
| 2 |
========== |
| 3 |
|
| 4 |
Kubernetes_ is a popular system for deploying distributed applications on clusters, |
| 5 |
particularly in the cloud. You can use Kubernetes to launch Dask clusters in the |
| 6 |
following ways: |
| 7 |
|
| 8 |
Dask Kubernetes Operator |
| 9 |
------------------------ |
| 10 |
|
| 11 |
The Dask Kubernetes Operator is a set of Custom Resource Definitions (CRDs) and a controller that |
| 12 |
allows you to create and manage your Dask clusters as native Kubernetes resources. |
| 13 |
|
| 14 |
Creating clusters can either be done via the Kubernetes API with ``kubectl`` or the |
| 15 |
Python API with ``KubeCluster``. |
| 16 |
|
| 17 |
.. code-block:: bash |
| 18 |
|
| 19 |
helm install --repo https://helm.dask.org --create-namespace -n dask-operator --generate-name dask-kubernetes-operator |
| 20 |
|
| 21 |
.. code-block:: bash |
| 22 |
|
| 23 |
# Create a cluster with kubectl |
| 24 |
kubectl apply -f - <<EOF |
| 25 |
apiVersion: kubernetes.dask.org/v1 |
| 26 |
kind: DaskCluster |
| 27 |
metadata: |
| 28 |
name: my-dask-cluster |
| 29 |
spec: |
| 30 |
... |
| 31 |
EOF |
| 32 |
|
| 33 |
.. code-block:: python |
| 34 |
|
| 35 |
# Create a cluster in Python |
| 36 |
from dask_kubernetes.operator import KubeCluster |
| 37 |
cluster = KubeCluster(name="my-dask-cluster", image='ghcr.io/dask/dask:latest') |
| 38 |
cluster.scale(10) |
| 39 |
|
| 40 |
This is a good choice if you want to do the following: |
| 41 |
|
| 42 |
1. Have a Kubernetes native experience. |
| 43 |
2. Manage Dask clusters via the Kubernetes API and tools like ``kubectl``. |
| 44 |
3. Integrate Dask with other tools and workloads running on Kubernetes. |
| 45 |
4. Compose Dask clusters as part of a larger Kubernetes application. |
| 46 |
|
| 47 |
Learn more at `kubernetes.dask.org <https://kubernetes.dask.org/en/latest/operator.html>`_. |
| 48 |
|
| 49 |
|
| 50 |
Dask Gateway |
| 51 |
------------ |
| 52 |
|
| 53 |
Dask Gateway provides a secure, multi-tenant server for managing Dask clusters. |
| 54 |
It allows users to launch and use Dask clusters in a shared, centrally managed cluster environment, |
| 55 |
without requiring users to have direct access to the underlying cluster backend |
| 56 |
(e.g. Kubernetes, Hadoop/YARN, HPC Job queues, etc…). |
| 57 |
|
| 58 |
.. code-block:: bash |
| 59 |
|
| 60 |
helm install --repo https://helm.dask.org --create-namespace -n dask-gateway --generate-name dask-gateway |
| 61 |
|
| 62 |
.. code-block:: python |
| 63 |
|
| 64 |
from dask_gateway import Gateway |
| 65 |
gateway = Gateway("<gateway service address>") |
| 66 |
cluster = gateway.new_cluster() |
| 67 |
|
| 68 |
This is a good choice if you want to do the following: |
| 69 |
|
| 70 |
1. Abstract users away from Kubernetes. |
| 71 |
2. Provide a consistent Dask user experience across Kubernetes/Hadoop/HPC. |
| 72 |
|
| 73 |
Learn more at `gateway.dask.org <https://gateway.dask.org/install-kube.html>`_. |
| 74 |
|
| 75 |
DaskHub |
| 76 |
^^^^^^^ |
| 77 |
|
| 78 |
You can also deploy Dask Gateway alongside `JupyterHub <https://jupyter.org/hub>`_ using the DaskHub helm chart. |
| 79 |
|
| 80 |
.. code-block:: bash |
| 81 |
|
| 82 |
helm install --repo https://helm.dask.org --create-namespace -n daskhub --generate-name daskhub |
| 83 |
|
| 84 |
Learn more at the `artifacthub.io DaskHub page <https://artifacthub.io/packages/helm/dask/daskhub>`_. |
| 85 |
|
| 86 |
|
| 87 |
Single Cluster Helm Chart |
| 88 |
------------------------- |
| 89 |
|
| 90 |
You can deploy a single Dask cluster and (optionally) Jupyter on Kubernetes |
| 91 |
easily using Helm_ |
| 92 |
|
| 93 |
.. code-block:: bash |
| 94 |
|
| 95 |
helm install --repo https://helm.dask.org my-dask dask |
| 96 |
|
| 97 |
This is a good choice if you want to do the following: |
| 98 |
|
| 99 |
1. Try out Dask for the first time on a cloud-based system |
| 100 |
like Amazon, Google, or Microsoft Azure where you already have |
| 101 |
a Kubernetes cluster. If you don't already have Kubernetes deployed, |
| 102 |
see our :doc:`Cloud documentation <deploying-cloud>`. |
| 103 |
|
| 104 |
You can also use the ``HelmCluster`` cluster manager from dask-kubernetes to manage your |
| 105 |
Helm Dask cluster from within your Python session. |
| 106 |
|
| 107 |
.. code-block:: python |
| 108 |
|
| 109 |
from dask_kubernetes import HelmCluster |
| 110 |
|
| 111 |
cluster = HelmCluster(release_name="myrelease") |
| 112 |
cluster.scale(10) |
| 113 |
|
| 114 |
Learn more at the `artifacthub.io Dask page <https://artifacthub.io/packages/helm/dask/dask>`_. |
| 115 |
|
| 116 |
Further Reading |
| 117 |
--------------- |
| 118 |
|
| 119 |
You may also want to see the documentation on using |
| 120 |
:doc:`Dask with Docker containers <deploying-docker>` |
| 121 |
to help you manage your software environments on Kubernetes. |
| 122 |
|
| 123 |
.. _Kubernetes: https://kubernetes.io/ |
| 124 |
.. _Dask-Kubernetes: https://kubernetes.dask.org/ |
| 125 |
.. _Helm: https://helm.sh/ |