From 80b976efcb20e1e0e36a3470512cf21713817d1c Mon Sep 17 00:00:00 2001 From: Vince Jankovics Date: Mon, 22 Jul 2019 23:45:05 +0100 Subject: [PATCH] Ray namespace added for k8s (#4111) * Ray namespace added for k8s * Submit.yaml update with k8s namespace * K8s deployment doc update with namespace --- doc/source/deploy-on-kubernetes.rst | 16 ++++++++-------- kubernetes/head.yaml | 7 +++++++ kubernetes/submit.yaml | 8 ++++++++ kubernetes/worker.yaml | 1 + 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/doc/source/deploy-on-kubernetes.rst b/doc/source/deploy-on-kubernetes.rst index f72836fe9..76e78239f 100644 --- a/doc/source/deploy-on-kubernetes.rst +++ b/doc/source/deploy-on-kubernetes.rst @@ -27,14 +27,14 @@ To work interactively, first start Ray on Kubernetes. kubectl create -f ray/kubernetes/worker.yaml This will start one head pod and 3 worker pods. You can check that the pods are -running by running ``kubectl get pods``. +running by running ``kubectl get pods -n ray``. You should see something like the following (you will have to wait a couple minutes for the pods to enter the "Running" state). .. code-block:: shell - $ kubectl get pods + $ kubectl get pods -n ray NAME READY STATUS RESTARTS AGE ray-head-5455bb66c9-6bxvz 1/1 Running 0 10s ray-worker-5c49b7cc57-c6xs8 1/1 Running 0 5s @@ -45,7 +45,7 @@ To run tasks interactively on the cluster, connect to one of the pods, e.g., .. code-block:: shell - kubectl exec -it ray-head-5455bb66c9-6bxvz -- bash + kubectl exec -it -n ray ray-head-5455bb66c9-6bxvz -- bash Start an IPython interpreter, e.g., ``ipython`` @@ -86,7 +86,7 @@ running ``kubectl get all``. You'll see output like the following. .. code-block:: shell - $ kubectl get all + $ kubectl get all -n ray NAME READY STATUS RESTARTS AGE pod/ray-head-5486648dc9-c6hz2 1/1 Running 0 11s pod/ray-worker-5c49b7cc57-2jz4l 1/1 Running 0 11s @@ -108,7 +108,7 @@ Find the name of the ``ray-head`` pod and run the equivalent of .. code-block:: shell - kubectl logs ray-head-5486648dc9-c6hz2 + kubectl logs ray-head-5486648dc9-c6hz2 -n ray Cleaning Up ----------- @@ -117,9 +117,9 @@ To remove the services you have created, run the following. .. code-block:: shell - kubectl delete service/ray-head \ - deployment.apps/ray-head \ - deployment.apps/ray-worker + kubectl delete -n ray service/ray-head \ + deployment.apps/ray-head \ + deployment.apps/ray-worker Customization diff --git a/kubernetes/head.yaml b/kubernetes/head.yaml index a535d35c4..a48e9752f 100644 --- a/kubernetes/head.yaml +++ b/kubernetes/head.yaml @@ -1,7 +1,13 @@ apiVersion: v1 +kind: Namespace +metadata: + name: ray +--- +apiVersion: v1 kind: Service metadata: name: ray-head + namespace: ray spec: ports: - name: redis-primary @@ -26,6 +32,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: ray-head + namespace: ray spec: replicas: 1 selector: diff --git a/kubernetes/submit.yaml b/kubernetes/submit.yaml index e6e66ae8d..f73075857 100644 --- a/kubernetes/submit.yaml +++ b/kubernetes/submit.yaml @@ -1,7 +1,13 @@ apiVersion: v1 +kind: Namespace +metadata: + name: ray +--- +apiVersion: v1 kind: Service metadata: name: ray-head + namespace: ray spec: ports: - name: redis-primary @@ -26,6 +32,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: ray-head + namespace: ray spec: replicas: 1 selector: @@ -72,6 +79,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: ray-worker + namespace: ray spec: replicas: 3 selector: diff --git a/kubernetes/worker.yaml b/kubernetes/worker.yaml index c9f4ea806..2b0399e2b 100644 --- a/kubernetes/worker.yaml +++ b/kubernetes/worker.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: ray-worker + namespace: ray spec: replicas: 3 selector: