diff --git a/helm-charts/seldon-core-loadtesting/templates/locust-master.yaml b/helm-charts/seldon-core-loadtesting/templates/locust-master.yaml index 07866526fe..f1fba95534 100644 --- a/helm-charts/seldon-core-loadtesting/templates/locust-master.yaml +++ b/helm-charts/seldon-core-loadtesting/templates/locust-master.yaml @@ -8,6 +8,7 @@ items: name: locust-master-{{ .Values.loadtest.id }} service: seldon name: locust-master-{{ .Values.loadtest.id }} + namespace: {{ .Release.Namespace }} spec: replicas: 1 selector: diff --git a/helm-charts/seldon-core-loadtesting/templates/locust-slave.yaml b/helm-charts/seldon-core-loadtesting/templates/locust-slave.yaml index 13d00bea74..cd860a734a 100644 --- a/helm-charts/seldon-core-loadtesting/templates/locust-slave.yaml +++ b/helm-charts/seldon-core-loadtesting/templates/locust-slave.yaml @@ -6,6 +6,7 @@ metadata: name: locust-slave-{{ .Values.loadtest.id }} service: seldon name: locust-slave-{{ .Values.loadtest.id }} + namespace: {{ .Release.Namespace }} spec: replicas: 1 selector: diff --git a/notebooks/kubectl_demo_minikube.ipynb b/notebooks/kubectl_demo_minikube.ipynb index a87f54671f..506b4620e0 100644 --- a/notebooks/kubectl_demo_minikube.ipynb +++ b/notebooks/kubectl_demo_minikube.ipynb @@ -48,9 +48,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -86,16 +84,14 @@ }, { "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, + "execution_count": 32, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "node \"kubeflow\" labeled\r\n" + "node \"minikube\" labeled\r\n" ] } ], @@ -119,24 +115,22 @@ }, { "cell_type": "code", - "execution_count": 54, - "metadata": { - "collapsed": false - }, + "execution_count": 7, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "NAME: seldon-core-crd\n", - "LAST DEPLOYED: Fri Feb 16 17:47:56 2018\n", - "NAMESPACE: test2\n", + "LAST DEPLOYED: Sat Feb 17 09:48:19 2018\n", + "NAMESPACE: default\n", "STATUS: DEPLOYED\n", "\n", "RESOURCES:\n", "==> v1beta1/CustomResourceDefinition\n", "NAME AGE\n", - "seldondeployments.machinelearning.seldon.io 1s\n", + "seldondeployments.machinelearning.seldon.io 0s\n", "\n", "\n", "NOTES:\n", @@ -152,56 +146,52 @@ }, { "cell_type": "code", - "execution_count": 55, - "metadata": { - "collapsed": false - }, + "execution_count": 9, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "namespace \"test-seldon\" created\r\n" + "namespace \"seldon\" created\r\n" ] } ], "source": [ - "!kubectl create namespace seldon-core" + "!kubectl create namespace seldon" ] }, { "cell_type": "code", - "execution_count": 56, - "metadata": { - "collapsed": false - }, + "execution_count": 10, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "NAME: seldon-core\n", - "LAST DEPLOYED: Fri Feb 16 17:48:09 2018\n", - "NAMESPACE: test-seldon\n", + "LAST DEPLOYED: Sat Feb 17 09:48:57 2018\n", + "NAMESPACE: seldon\n", "STATUS: DEPLOYED\n", "\n", "RESOURCES:\n", "==> v1beta1/Deployment\n", "NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE\n", "seldon-apiserver 1 1 1 0 0s\n", - "seldon-cluster-manager 1 1 1 0 0s\n", - "redis 1 1 1 0 0s\n", + "seldon-cluster-manager 1 0 0 0 0s\n", + "redis 1 0 0 0 0s\n", "\n", "==> v1/Service\n", - "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", - "seldon-apiserver NodePort 10.99.54.30 8080:30088/TCP,5000:32466/TCP 0s\n", - "redis ClusterIP 10.106.49.165 6379/TCP 0s\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", + "seldon-apiserver NodePort 10.108.253.147 8080:30370/TCP,5000:31436/TCP 0s\n", + "redis ClusterIP 10.102.153.105 6379/TCP 0s\n", "\n", "==> v1/Pod(related)\n", - "NAME READY STATUS RESTARTS AGE\n", - "seldon-apiserver-7cb8568bb9-wv9th 0/1 ContainerCreating 0 0s\n", - "seldon-cluster-manager-9fbcc85c-mt7bz 0/1 ContainerCreating 0 0s\n", - "redis-5767447797-hfdvk 0/1 ContainerCreating 0 0s\n", + "NAME READY STATUS RESTARTS AGE\n", + "seldon-apiserver-5596577b55-d29zg 0/1 ContainerCreating 0 0s\n", + "seldon-cluster-manager-576c6ddf5-b7s6w 0/1 ContainerCreating 0 0s\n", + "redis-df886d999-6fvfx 0/1 ContainerCreating 0 0s\n", "\n", "\n", "NOTES:\n", @@ -212,7 +202,7 @@ } ], "source": [ - "!helm install ../helm-charts/seldon-core --name seldon-core --namespace seldon-core" + "!helm install ../helm-charts/seldon-core --name seldon-core --namespace seldon" ] }, { @@ -224,60 +214,58 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, + "execution_count": 11, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "NAME: seldon-core-analytics\n", - "LAST DEPLOYED: Wed Feb 14 18:13:02 2018\n", - "NAMESPACE: default\n", + "LAST DEPLOYED: Sat Feb 17 09:51:20 2018\n", + "NAMESPACE: seldon\n", "STATUS: DEPLOYED\n", "\n", "RESOURCES:\n", - "==> v1/Service\n", - "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", - "alertmanager ClusterIP 10.97.66.126 80/TCP 0s\n", - "grafana-prom NodePort 10.104.145.124 80:30034/TCP 0s\n", - "prometheus-node-exporter ClusterIP None 9100/TCP 0s\n", - "prometheus-seldon ClusterIP 10.103.161.138 80/TCP 0s\n", - "\n", - "==> v1beta1/DaemonSet\n", - "NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE\n", - "prometheus-node-exporter 1 1 0 1 0 0s\n", - "\n", - "==> v1/Pod(related)\n", - "NAME READY STATUS RESTARTS AGE\n", - "grafana-prom-import-dashboards-9kc9f 0/1 ContainerCreating 0 0s\n", - "alertmanager-deployment-5478cc6dbb-kjwlf 0/1 ContainerCreating 0 0s\n", - "grafana-prom-deployment-7b45fb85d4-lt4pq 0/1 ContainerCreating 0 0s\n", - "prometheus-node-exporter-n4725 0/1 ContainerCreating 0 0s\n", - "prometheus-deployment-5db585cb7b-pdhdf 0/1 ContainerCreating 0 0s\n", - "\n", "==> v1/Secret\n", "NAME TYPE DATA AGE\n", - "grafana-prom-secret Opaque 1 0s\n", + "grafana-prom-secret Opaque 1 1s\n", "\n", "==> v1/ConfigMap\n", "NAME DATA AGE\n", - "alertmanager-server-conf 1 0s\n", - "grafana-import-dashboards 5 0s\n", - "prometheus-rules 4 0s\n", - "prometheus-server-conf 1 0s\n", + "alertmanager-server-conf 1 1s\n", + "grafana-import-dashboards 5 1s\n", + "prometheus-rules 4 1s\n", + "prometheus-server-conf 1 1s\n", "\n", "==> v1/Job\n", "NAME DESIRED SUCCESSFUL AGE\n", - "grafana-prom-import-dashboards 1 0 0s\n", + "grafana-prom-import-dashboards 1 0 1s\n", "\n", "==> v1beta1/Deployment\n", "NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE\n", - "alertmanager-deployment 1 1 1 0 0s\n", - "grafana-prom-deployment 1 1 1 0 0s\n", - "prometheus-deployment 1 1 1 0 0s\n", + "alertmanager-deployment 1 1 1 0 1s\n", + "grafana-prom-deployment 1 1 1 0 1s\n", + "prometheus-deployment 1 1 1 0 1s\n", + "\n", + "==> v1/Service\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", + "alertmanager ClusterIP 10.110.34.128 80/TCP 1s\n", + "grafana-prom NodePort 10.104.31.240 80:30579/TCP 1s\n", + "prometheus-node-exporter ClusterIP None 9100/TCP 1s\n", + "prometheus-seldon ClusterIP 10.105.137.48 80/TCP 1s\n", + "\n", + "==> v1beta1/DaemonSet\n", + "NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE\n", + "prometheus-node-exporter 1 1 0 1 0 1s\n", + "\n", + "==> v1/Pod(related)\n", + "NAME READY STATUS RESTARTS AGE\n", + "grafana-prom-import-dashboards-5vpsx 0/1 ContainerCreating 0 1s\n", + "alertmanager-deployment-7fbfdfdfb6-lpqrm 0/1 ContainerCreating 0 1s\n", + "grafana-prom-deployment-7b45fb85d4-prswq 0/1 ContainerCreating 0 1s\n", + "prometheus-node-exporter-smq4c 0/1 ContainerCreating 0 1s\n", + "prometheus-deployment-5749d9db5-bmb5n 0/1 ContainerCreating 0 1s\n", "\n", "\n", "NOTES:\n", @@ -291,7 +279,7 @@ "!helm install ../helm-charts/seldon-core-analytics --name seldon-core-analytics \\\n", " --set grafana_prom_admin_password=password \\\n", " --set persistence.enabled=false \\\n", - " --namespace seldon-core" + " --namespace seldon" ] }, { @@ -303,24 +291,26 @@ }, { "cell_type": "code", - "execution_count": 30, - "metadata": { - "collapsed": false - }, + "execution_count": 13, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "NAME READY STATUS RESTARTS AGE\r\n", - "redis-5767447797-rdb5g 1/1 Running 0 22s\r\n", - "seldon-apiserver-7cb8568bb9-bjz57 1/1 Running 0 22s\r\n", - "seldon-cluster-manager-9fbcc85c-tkrc6 1/1 Running 0 22s\r\n" + "NAME READY STATUS RESTARTS AGE\r\n", + "alertmanager-deployment-7fbfdfdfb6-lpqrm 1/1 Running 0 1m\r\n", + "grafana-prom-deployment-7b45fb85d4-prswq 1/1 Running 0 1m\r\n", + "prometheus-deployment-5749d9db5-bmb5n 1/1 Running 0 1m\r\n", + "prometheus-node-exporter-smq4c 1/1 Running 0 1m\r\n", + "redis-df886d999-6fvfx 1/1 Running 0 4m\r\n", + "seldon-apiserver-5596577b55-d29zg 1/1 Running 0 4m\r\n", + "seldon-cluster-manager-576c6ddf5-b7s6w 1/1 Running 0 4m\r\n" ] } ], "source": [ - "!kubectl get pods" + "!kubectl get pods -n seldon" ] }, { @@ -339,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 14, "metadata": { "collapsed": true }, @@ -358,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 15, "metadata": { "collapsed": true }, @@ -371,9 +361,10 @@ "import grpc\n", "import commands\n", "\n", + "NAMESPACE='seldon'\n", "MINIKUBE_IP=commands.getoutput('minikube ip')\n", - "MINIKUBE_HTTP_PORT=commands.getoutput(\"kubectl get svc -n test -l app=seldon-apiserver-container-app -o jsonpath='{.items[0].spec.ports[0].nodePort}'\")\n", - "MINIKUBE_GRPC_PORT=commands.getoutput(\"kubectl get svc -n test -l app=seldon-apiserver-container-app -o jsonpath='{.items[0].spec.ports[1].nodePort}'\")\n", + "MINIKUBE_HTTP_PORT=commands.getoutput(\"kubectl get svc -n \"+NAMESPACE+\" -l app=seldon-apiserver-container-app -o jsonpath='{.items[0].spec.ports[0].nodePort}'\")\n", + "MINIKUBE_GRPC_PORT=commands.getoutput(\"kubectl get svc -n \"+NAMESPACE+\" -l app=seldon-apiserver-container-app -o jsonpath='{.items[0].spec.ports[1].nodePort}'\")\n", "\n", "def get_token():\n", " payload = {'grant_type': 'client_credentials'}\n", @@ -435,16 +426,14 @@ }, { "cell_type": "code", - "execution_count": 58, - "metadata": { - "collapsed": false - }, + "execution_count": 16, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "The SeldonDeployment \"seldon-deployment-example\" is invalid: []: Invalid value: map[string]interface {}{\"apiVersion\":\"machinelearning.seldon.io/v1alpha1\", \"kind\":\"SeldonDeployment\", \"metadata\":map[string]interface {}{\"name\":\"seldon-deployment-example\", \"namespace\":\"test-seldon\", \"deletionGracePeriodSeconds\":(*int64)(nil), \"uid\":\"7cc3f1ff-1343-11e8-a9e2-0800276a4c60\", \"clusterName\":\"\", \"labels\":map[string]interface {}{\"app\":\"seldon\"}, \"deletionTimestamp\":interface {}(nil), \"creationTimestamp\":\"2018-02-16T18:02:01Z\", \"selfLink\":\"\", \"initializers\":interface {}(nil)}, \"spec\":map[string]interface {}{\"name\":\"test-deployment\", \"oauth_key\":1234, \"oauth_secret\":\"oauth-secret\", \"predictors\":[]interface {}{map[string]interface {}{\"annotations\":map[string]interface {}{\"predictor_version\":\"v1\"}, \"componentSpec\":map[string]interface {}{\"spec\":map[string]interface {}{\"containers\":[]interface {}{map[string]interface {}{\"image\":\"seldonio/mean_classifier:0.6\", \"imagePullPolicy\":22, \"name\":\"mean-classifier\", \"resources\":map[string]interface {}{\"requests\":map[string]interface {}{\"memory\":\"1Mi\"}}}}, \"terminationGracePeriodSeconds\":20}}, \"graph\":map[string]interface {}{\"children\":[]interface {}{}, \"endpoint\":map[string]interface {}{\"type\":\"REST\"}, \"name\":\"mean-classifier\", \"type\":\"MODEL\"}, \"name\":\"fx-market-predictor\", \"replicas\":1}}, \"annotations\":map[string]interface {}{\"project_name\":\"FX Market Prediction\", \"deployment_version\":\"v1\"}}}: validation failure list:\r\n", + "The SeldonDeployment \"seldon-deployment-example\" is invalid: []: Invalid value: map[string]interface {}{\"apiVersion\":\"machinelearning.seldon.io/v1alpha1\", \"kind\":\"SeldonDeployment\", \"metadata\":map[string]interface {}{\"labels\":map[string]interface {}{\"app\":\"seldon\"}, \"name\":\"seldon-deployment-example\", \"namespace\":\"seldon\", \"creationTimestamp\":\"2018-02-17T09:53:36Z\", \"uid\":\"6c135aca-13c8-11e8-93d3-0800277d1140\", \"selfLink\":\"\", \"clusterName\":\"\"}, \"spec\":map[string]interface {}{\"predictors\":[]interface {}{map[string]interface {}{\"annotations\":map[string]interface {}{\"predictor_version\":\"v1\"}, \"componentSpec\":map[string]interface {}{\"spec\":map[string]interface {}{\"containers\":[]interface {}{map[string]interface {}{\"image\":\"seldonio/mean_classifier:0.6\", \"imagePullPolicy\":22, \"name\":\"mean-classifier\", \"resources\":map[string]interface {}{\"requests\":map[string]interface {}{\"memory\":\"1Mi\"}}}}, \"terminationGracePeriodSeconds\":20}}, \"graph\":map[string]interface {}{\"children\":[]interface {}{}, \"endpoint\":map[string]interface {}{\"type\":\"REST\"}, \"name\":\"mean-classifier\", \"type\":\"MODEL\"}, \"name\":\"fx-market-predictor\", \"replicas\":1}}, \"annotations\":map[string]interface {}{\"deployment_version\":\"v1\", \"project_name\":\"FX Market Prediction\"}, \"name\":\"test-deployment\", \"oauth_key\":1234, \"oauth_secret\":\"oauth-secret\"}}: validation failure list:\r\n", "spec.oauth_key in body must be of type string: \"integer\"\r\n" ] } @@ -463,64 +452,62 @@ }, { "cell_type": "code", - "execution_count": 59, - "metadata": { - "collapsed": false - }, + "execution_count": 18, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\r\n", - " \"apiVersion\": \"machinelearning.seldon.io/v1alpha1\",\r\n", - " \"kind\": \"SeldonDeployment\",\r\n", - " \"metadata\": {\r\n", - " \"labels\": {\r\n", - " \"app\": \"seldon\"\r\n", + " \u001b[34;01m\"apiVersion\"\u001b[39;49;00m: \u001b[33m\"machinelearning.seldon.io/v1alpha1\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"kind\"\u001b[39;49;00m: \u001b[33m\"SeldonDeployment\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"metadata\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"labels\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"app\"\u001b[39;49;00m: \u001b[33m\"seldon\"\u001b[39;49;00m\r\n", " },\r\n", - " \"name\": \"seldon-deployment-example\",\r\n", - "\t\"namespace\": \"test-seldon\"\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"seldon-deployment-example\"\u001b[39;49;00m,\r\n", + "\t\u001b[34;01m\"namespace\"\u001b[39;49;00m: \u001b[33m\"seldon\"\u001b[39;49;00m\r\n", " },\r\n", - " \"spec\": {\r\n", - " \"annotations\": {\r\n", - " \"project_name\": \"FX Market Prediction\",\r\n", - " \"deployment_version\": \"v1\"\r\n", + " \u001b[34;01m\"spec\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"annotations\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"project_name\"\u001b[39;49;00m: \u001b[33m\"FX Market Prediction\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"deployment_version\"\u001b[39;49;00m: \u001b[33m\"v1\"\u001b[39;49;00m\r\n", " },\r\n", - " \"name\": \"test-deployment\",\r\n", - " \"oauth_key\": \"oauth-key\",\r\n", - " \"oauth_secret\": \"oauth-secret\",\r\n", - " \"predictors\": [\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"test-deployment\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"oauth_key\"\u001b[39;49;00m: \u001b[33m\"oauth-key\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"oauth_secret\"\u001b[39;49;00m: \u001b[33m\"oauth-secret\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"predictors\"\u001b[39;49;00m: [\r\n", " {\r\n", - " \"componentSpec\": {\r\n", - " \"spec\": {\r\n", - " \"containers\": [\r\n", + " \u001b[34;01m\"componentSpec\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"spec\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"containers\"\u001b[39;49;00m: [\r\n", " {\r\n", - " \"image\": \"seldonio/mock_classifier:1.0\",\r\n", - " \"imagePullPolicy\": \"IfNotPresent\",\r\n", - " \"name\": \"classifier\",\r\n", - " \"resources\": {\r\n", - " \"requests\": {\r\n", - " \"memory\": \"1Mi\"\r\n", + " \u001b[34;01m\"image\"\u001b[39;49;00m: \u001b[33m\"seldonio/mock_classifier:1.0\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"imagePullPolicy\"\u001b[39;49;00m: \u001b[33m\"IfNotPresent\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"classifier\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"resources\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"requests\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"memory\"\u001b[39;49;00m: \u001b[33m\"1Mi\"\u001b[39;49;00m\r\n", " }\r\n", " }\r\n", " }\r\n", " ],\r\n", - " \"terminationGracePeriodSeconds\": 20\r\n", + " \u001b[34;01m\"terminationGracePeriodSeconds\"\u001b[39;49;00m: \u001b[34m20\u001b[39;49;00m\r\n", " }\r\n", " },\r\n", - " \"graph\": {\r\n", - " \"children\": [],\r\n", - " \"name\": \"classifier\",\r\n", - " \"endpoint\": {\r\n", - "\t\t\t\"type\" : \"REST\"\r\n", + " \u001b[34;01m\"graph\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"children\"\u001b[39;49;00m: [],\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"classifier\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"endpoint\"\u001b[39;49;00m: {\r\n", + "\t\t\t\u001b[34;01m\"type\"\u001b[39;49;00m : \u001b[33m\"REST\"\u001b[39;49;00m\r\n", "\t\t },\r\n", - " \"type\": \"MODEL\"\r\n", + " \u001b[34;01m\"type\"\u001b[39;49;00m: \u001b[33m\"MODEL\"\u001b[39;49;00m\r\n", " },\r\n", - " \"name\": \"fx-market-predictor\",\r\n", - " \"replicas\": 1,\r\n", - "\t\t\"annotations\": {\r\n", - "\t\t \"predictor_version\" : \"v1\"\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"fx-market-predictor\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"replicas\"\u001b[39;49;00m: \u001b[34m1\u001b[39;49;00m,\r\n", + "\t\t\u001b[34;01m\"annotations\"\u001b[39;49;00m: {\r\n", + "\t\t \u001b[34;01m\"predictor_version\"\u001b[39;49;00m : \u001b[33m\"v1\"\u001b[39;49;00m\r\n", "\t\t}\r\n", " }\r\n", " ]\r\n", @@ -530,7 +517,7 @@ } ], "source": [ - "!cat resources/model.json" + "!pygmentize resources/model.json" ] }, { @@ -549,10 +536,8 @@ }, { "cell_type": "code", - "execution_count": 34, - "metadata": { - "collapsed": false - }, + "execution_count": 19, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -563,55 +548,49 @@ } ], "source": [ - "!kubectl apply -f resources/model_tmp.json" + "!kubectl apply -f resources/model.json" ] }, { "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false - }, + "execution_count": 20, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "NAME AGE\r\n", - "seldon-deployment-example 0s\r\n" + "seldon-deployment-example 9s\r\n" ] } ], "source": [ - "!kubectl get seldondeployments" + "!kubectl get seldondeployments -n seldon" ] }, { "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, + "execution_count": 21, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Name: seldon-deployment-example\r\n", - "Namespace: test\r\n", + "Namespace: seldon\r\n", "Labels: app=seldon\r\n", - "Annotations: kubectl.kubernetes.io/last-applied-configuration={\"apiVersion\":\"machinelearning.seldon.io/v1alpha1\",\"kind\":\"SeldonDeployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"seldon\"},\"name\":\"seldon-depl...\r\n", + "Annotations: kubectl.kubernetes.io/last-applied-configuration={\"apiVersion\":\"machinelearning.seldon.io/v1alpha1\",\"kind\":\"SeldonDeployment\",\"metadata\":{\"name\":\"seldon-deployment-example\",\"namespace\":\"seldon\",\"selfL...\r\n", "API Version: machinelearning.seldon.io/v1alpha1\r\n", "Kind: SeldonDeployment\r\n", "Metadata:\r\n", - " Cluster Name: \r\n", - " Creation Timestamp: 2018-02-16T15:19:01Z\r\n", - " Deletion Grace Period Seconds: \r\n", - " Deletion Timestamp: \r\n", - " Initializers: \r\n", - " Resource Version: 3004\r\n", - " Self Link: /apis/machinelearning.seldon.io/v1alpha1/namespaces/test/seldondeployments/seldon-deployment-example\r\n", - " UID: b78833ec-132c-11e8-a9e2-0800276a4c60\r\n", + " Cluster Name: \r\n", + " Creation Timestamp: 2018-02-17T09:54:46Z\r\n", + " Generation: 0\r\n", + " Resource Version: 1871\r\n", + " Self Link: /apis/machinelearning.seldon.io/v1alpha1/namespaces/seldon/seldondeployments/seldon-deployment-example\r\n", + " UID: 960dabba-13c8-11e8-93d3-0800277d1140\r\n", "Spec:\r\n", " Annotations:\r\n", " Deployment _ Version: v1\r\n", @@ -623,29 +602,71 @@ " Annotations:\r\n", " Predictor _ Version: v1\r\n", " Component Spec:\r\n", + " Metadata:\r\n", + " Labels:\r\n", + " Seldon - App: test-deployment\r\n", " Spec:\r\n", " Containers:\r\n", + " Env:\r\n", + " Name: PREDICTIVE_UNIT_SERVICE_PORT\r\n", + " Value: 9000\r\n", + " Name: PREDICTIVE_UNIT_PARAMETERS\r\n", + " Value: []\r\n", + " Name: PREDICTIVE_UNIT_ID\r\n", + " Value: classifier\r\n", + " Name: PREDICTOR_ID\r\n", + " Value: fx-market-predictor\r\n", + " Name: SELDON_DEPLOYMENT_ID\r\n", + " Value: seldon-deployment-example\r\n", " Image: seldonio/mock_classifier:1.0\r\n", " Image Pull Policy: IfNotPresent\r\n", - " Name: classifier\r\n", + " Lifecycle:\r\n", + " Pre Stop:\r\n", + " Exec:\r\n", + " Command:\r\n", + " /bin/sh\r\n", + " -c\r\n", + " /bin/sleep 5\r\n", + " Liveness Probe:\r\n", + " Handler:\r\n", + " Tcp Socket:\r\n", + " Port: http\r\n", + " Initial Delay Seconds: 10\r\n", + " Period Seconds: 5\r\n", + " Name: classifier\r\n", + " Ports:\r\n", + " Container Port: 9000\r\n", + " Name: http\r\n", + " Readiness Probe:\r\n", + " Handler:\r\n", + " Tcp Socket:\r\n", + " Port: http\r\n", + " Initial Delay Seconds: 10\r\n", + " Period Seconds: 5\r\n", " Resources:\r\n", " Requests:\r\n", " Memory: 1Mi\r\n", " Termination Grace Period Seconds: 20\r\n", " Graph:\r\n", - " Children:\r\n", " Endpoint:\r\n", - " Type: REST\r\n", - " Name: classifier\r\n", - " Type: MODEL\r\n", - " Name: fx-market-predictor\r\n", - " Replicas: 1\r\n", - "Events: \r\n" + " Service _ Host: 0.0.0.0\r\n", + " Service _ Port: 9000\r\n", + " Type: REST\r\n", + " Name: classifier\r\n", + " Type: MODEL\r\n", + " Name: fx-market-predictor\r\n", + " Replicas: 1\r\n", + "Status:\r\n", + " Predictor Status:\r\n", + " Name: test-deployment-fx-market-predictor\r\n", + " Replicas: 1\r\n", + " Replicas Available: 1\r\n", + "Events: \r\n" ] } ], "source": [ - "!kubectl describe seldondeployments seldon-deployment-example " + "!kubectl describe seldondeployments seldon-deployment-example -n seldon" ] }, { @@ -657,10 +678,8 @@ }, { "cell_type": "code", - "execution_count": 38, - "metadata": { - "collapsed": false - }, + "execution_count": 22, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -671,7 +690,7 @@ } ], "source": [ - "!kubectl get seldondeployments seldon-deployment-example -o jsonpath='{.status}'" + "!kubectl get seldondeployments seldon-deployment-example -o jsonpath='{.status}' -n seldon" ] }, { @@ -690,19 +709,17 @@ }, { "cell_type": "code", - "execution_count": 70, - "metadata": { - "collapsed": false - }, + "execution_count": 23, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{\"access_token\":\"3a28461a-455a-48cf-a00c-e01c232e18af\",\"token_type\":\"bearer\",\"expires_in\":42837,\"scope\":\"read write\"}\n", + "{\"access_token\":\"28de63ce-0001-47a8-ad76-54e00f6ad300\",\"token_type\":\"bearer\",\"expires_in\":43199,\"scope\":\"read write\"}\n", "{\n", " \"meta\": {\n", - " \"puid\": \"vcckqcb0ar0aqmjj6t29g6q1g6\",\n", + " \"puid\": \"9uhc299436fhfa4tdpa8l8gnph\",\n", " \"tags\": {\n", " },\n", " \"routing\": {\n", @@ -732,18 +749,16 @@ }, { "cell_type": "code", - "execution_count": 50, - "metadata": { - "collapsed": false - }, + "execution_count": 24, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{\"access_token\":\"05897719-cad5-437c-9b2e-262afe38d65c\",\"token_type\":\"bearer\",\"expires_in\":43194,\"scope\":\"read write\"}\n", + "{\"access_token\":\"28de63ce-0001-47a8-ad76-54e00f6ad300\",\"token_type\":\"bearer\",\"expires_in\":43198,\"scope\":\"read write\"}\n", "meta {\n", - " puid: \"9rmpkosit7b86mttocn8ubpl7k\"\n", + " puid: \"o3l8k9c0up05vu5g8orshpp7pd\"\n", "}\n", "data {\n", " names: \"proba\"\n", @@ -783,22 +798,110 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\r\n", + " \u001b[34;01m\"apiVersion\"\u001b[39;49;00m: \u001b[33m\"machinelearning.seldon.io/v1alpha1\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"kind\"\u001b[39;49;00m: \u001b[33m\"SeldonDeployment\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"metadata\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"labels\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"app\"\u001b[39;49;00m: \u001b[33m\"seldon\"\u001b[39;49;00m\r\n", + " },\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"seldon-deployment-example\"\u001b[39;49;00m,\r\n", + "\t\u001b[34;01m\"namespace\"\u001b[39;49;00m : \u001b[33m\"seldon\"\u001b[39;49;00m\r\n", + " },\r\n", + " \u001b[34;01m\"spec\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"annotations\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"project_name\"\u001b[39;49;00m: \u001b[33m\"FX Market Prediction\"\u001b[39;49;00m\r\n", + " },\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"test-deployment\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"oauth_key\"\u001b[39;49;00m: \u001b[33m\"oauth-key\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"oauth_secret\"\u001b[39;49;00m: \u001b[33m\"oauth-secret\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"predictors\"\u001b[39;49;00m: [\r\n", + " {\r\n", + " \u001b[34;01m\"componentSpec\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"spec\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"containers\"\u001b[39;49;00m: [\r\n", + " {\r\n", + " \u001b[34;01m\"image\"\u001b[39;49;00m: \u001b[33m\"seldonio/mean_classifier:0.6\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"imagePullPolicy\"\u001b[39;49;00m: \u001b[33m\"IfNotPresent\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"mean-classifier\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"resources\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"requests\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"memory\"\u001b[39;49;00m: \u001b[33m\"1Mi\"\u001b[39;49;00m\r\n", + " }\r\n", + " }\r\n", + " }\r\n", + " ]\r\n", + " }\r\n", + " },\r\n", + " \u001b[34;01m\"graph\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"children\"\u001b[39;49;00m: [],\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"mean-classifier\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"endpoint\"\u001b[39;49;00m: {\r\n", + "\t\t\t\u001b[34;01m\"type\"\u001b[39;49;00m : \u001b[33m\"REST\"\u001b[39;49;00m\r\n", + "\t\t },\r\n", + " \u001b[34;01m\"type\"\u001b[39;49;00m: \u001b[33m\"MODEL\"\u001b[39;49;00m\r\n", + " },\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"fx-market-predictor\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"replicas\"\u001b[39;49;00m: \u001b[34m1\u001b[39;49;00m\r\n", + " },\r\n", + " {\r\n", + " \u001b[34;01m\"componentSpec\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"spec\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"containers\"\u001b[39;49;00m: [\r\n", + " {\r\n", + " \u001b[34;01m\"image\"\u001b[39;49;00m: \u001b[33m\"seldonio/mean_classifier:0.6\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"imagePullPolicy\"\u001b[39;49;00m: \u001b[33m\"IfNotPresent\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"mean-classifier\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"resources\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"requests\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"memory\"\u001b[39;49;00m: \u001b[33m\"1Mi\"\u001b[39;49;00m\r\n", + " }\r\n", + " }\r\n", + " }\r\n", + " ]\r\n", + " }\r\n", + " },\r\n", + " \u001b[34;01m\"graph\"\u001b[39;49;00m: {\r\n", + " \u001b[34;01m\"children\"\u001b[39;49;00m: [],\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"mean-classifier\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"endpoint\"\u001b[39;49;00m: {\r\n", + "\t\t\t\u001b[34;01m\"type\"\u001b[39;49;00m : \u001b[33m\"REST\"\u001b[39;49;00m\r\n", + "\t\t },\r\n", + " \u001b[34;01m\"type\"\u001b[39;49;00m: \u001b[33m\"MODEL\"\u001b[39;49;00m\r\n", + " },\r\n", + " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"fx-market-predictor-canary\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"replicas\"\u001b[39;49;00m: \u001b[34m1\u001b[39;49;00m\r\n", + " }\r\n", + " ]\r\n", + " }\r\n", + "}\r\n" + ] + } + ], "source": [ - "!cat resources/model_with_canary.json" + "!pygmentize resources/model_with_canary.json" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "seldondeployment \"seldon-deployment-example\" configured\r\n" + ] + } + ], "source": [ "!kubectl apply -f resources/model_with_canary.json" ] @@ -812,13 +915,19 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "map[predictorStatus:[map[name:test-deployment-fx-market-predictor replicas:1 replicasAvailable:1] map[replicasAvailable:1 name:test-deployment-fx-market-predictor-canary replicas:1]]]" + ] + } + ], "source": [ - "!kubectl get seldondeployments seldon-deployment-example -o jsonpath='{.status}'" + "!kubectl get seldondeployments seldon-deployment-example -o jsonpath='{.status}' -n seldon" ] }, { @@ -830,11 +939,33 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\"access_token\":\"28de63ce-0001-47a8-ad76-54e00f6ad300\",\"token_type\":\"bearer\",\"expires_in\":43006,\"scope\":\"read write\"}\n", + "{\n", + " \"meta\": {\n", + " \"puid\": \"tjsp6p2etelhl78a0b5ajuheq6\",\n", + " \"tags\": {\n", + " },\n", + " \"routing\": {\n", + " }\n", + " },\n", + " \"data\": {\n", + " \"names\": [\"proba\"],\n", + " \"tensor\": {\n", + " \"shape\": [2, 1],\n", + " \"values\": [0.05133579311531625, 0.12823373759251927]\n", + " }\n", + " }\n", + "}\n" + ] + } + ], "source": [ "rest_request()" ] @@ -848,11 +979,31 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\"access_token\":\"28de63ce-0001-47a8-ad76-54e00f6ad300\",\"token_type\":\"bearer\",\"expires_in\":43002,\"scope\":\"read write\"}\n", + "meta {\n", + " puid: \"8g0nuebc55mh5f3gm55hj3pfmu\"\n", + "}\n", + "data {\n", + " names: \"proba\"\n", + " tensor {\n", + " shape: 3\n", + " shape: 1\n", + " values: 0.128233737593\n", + " values: 0.397314662022\n", + " values: 0.829676081356\n", + " }\n", + "}\n", + "\n" + ] + } + ], "source": [ "grpc_request()" ] @@ -873,15 +1024,42 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME: loadtest\r\n", + "LAST DEPLOYED: Sat Feb 17 10:03:54 2018\r\n", + "NAMESPACE: seldon\r\n", + "STATUS: DEPLOYED\r\n", + "\r\n", + "RESOURCES:\r\n", + "==> v1/ReplicationController\r\n", + "NAME DESIRED CURRENT READY AGE\r\n", + "locust-slave-1 1 1 0 0s\r\n", + "locust-master-1 1 1 0 0s\r\n", + "\r\n", + "==> v1/Service\r\n", + "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\r\n", + "locust-master-1 NodePort 10.101.224.162 5557:30526/TCP,5558:30920/TCP,8089:30915/TCP 0s\r\n", + "\r\n", + "==> v1/Pod(related)\r\n", + "NAME READY STATUS RESTARTS AGE\r\n", + "locust-slave-1-ppx8s 0/1 Pending 0 0s\r\n", + "locust-master-1-pvsr2 0/1 Pending 0 0s\r\n", + "\r\n", + "\r\n" + ] + } + ], "source": [ "!helm install seldon-core-loadtesting --name loadtest \\\n", " --set oauth.key=oauth-key \\\n", " --set oauth.secret=oauth-secret \\\n", + " --namespace seldon \\\n", " --repo https://storage.googleapis.com/seldon-charts" ] }, @@ -892,7 +1070,7 @@ "You should port-foward the grafana dashboard\n", "\n", "```bash\n", - "kubectl port-forward $(kubectl get pods -n test -l app=grafana-prom-server -o jsonpath='{.items[0].metadata.name}') -n test 3000:3000\n", + "kubectl port-forward $(kubectl get pods -n seldon -l app=grafana-prom-server -o jsonpath='{.items[0].metadata.name}') -n seldon 3000:3000\n", "```\n", "\n", "You can then iew an analytics dashboard inside the cluster at http://localhost:3000/dashboard/db/prediction-analytics?refresh=5s&orgId=1. Your IP address may be different. get it via minikube ip. Login with:\n", @@ -914,37 +1092,89 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "release \"loadtest\" deleted\r\n" + ] + } + ], "source": [ "!helm delete loadtest --purge" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "seldondeployment \"seldon-deployment-example\" deleted\r\n" + ] + } + ], "source": [ "!kubectl delete -f resources/model_with_canary.json" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "release \"seldon-core-analytics\" deleted\r\n" + ] + } + ], "source": [ "!helm delete seldon-core-analytics --purge" ] }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "release \"seldon-core\" deleted\r\n" + ] + } + ], + "source": [ + "!helm delete seldon-core --purge" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "release \"seldon-core-crd\" deleted\r\n" + ] + } + ], + "source": [ + "!helm delete seldon-core-crd --purge" + ] + }, { "cell_type": "code", "execution_count": null, @@ -952,9 +1182,7 @@ "collapsed": true }, "outputs": [], - "source": [ - "!helm delete seldon-core --purge" - ] + "source": [] } ], "metadata": { @@ -973,7 +1201,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.11" + "version": "2.7.14" } }, "nbformat": 4, diff --git a/notebooks/resources/model.json b/notebooks/resources/model.json index 8a04ebb735..6877d1c682 100644 --- a/notebooks/resources/model.json +++ b/notebooks/resources/model.json @@ -6,7 +6,7 @@ "app": "seldon" }, "name": "seldon-deployment-example", - "namespace": "test-seldon" + "namespace": "seldon" }, "spec": { "annotations": { diff --git a/notebooks/resources/model_with_canary.json b/notebooks/resources/model_with_canary.json index d63938d2db..264072dcda 100644 --- a/notebooks/resources/model_with_canary.json +++ b/notebooks/resources/model_with_canary.json @@ -5,7 +5,8 @@ "labels": { "app": "seldon" }, - "name": "seldon-deployment-example" + "name": "seldon-deployment-example", + "namespace" : "seldon" }, "spec": { "annotations": {