From 382b254c4bdcb2186d9796a4f88f3e66ad8f6a4e Mon Sep 17 00:00:00 2001 From: timlackhan <727781157@qq.com> Date: Tue, 17 Sep 2019 11:44:14 +0800 Subject: [PATCH] Add "machine-learning-ui deploy with k8s" --- machine-learning-ui/README.md | 18 +++++++++ .../machine-learning-ui-deployment.yaml | 39 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 machine-learning-ui/machine-learning-ui-deployment.yaml diff --git a/machine-learning-ui/README.md b/machine-learning-ui/README.md index f004101..156f5f9 100644 --- a/machine-learning-ui/README.md +++ b/machine-learning-ui/README.md @@ -33,3 +33,21 @@ Extra Build ARGs - ``swupd_args`` Specifies [SWUPD](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options) flags Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#arg + +### Deploy with Kubernetes + +This image can also be deployed on a Kubernetes cluster, such as [minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/).The following example YAML files are provided in the repository as reference for Kubernetes deployment: + +- [`machine-learning-ui-deployment.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/machine-learning-ui/machine-learning-ui-deployment.yaml): example to provide jupyter notebook service. + + + +Steps to deploy notebook on a Kubernetes cluster: + +1. Deploy `machine-learning-ui-deployment.yaml` + + ``` + kubectl create -f machine-learning-ui-deployment.yaml + ``` + +2. Navigate to [http://\:30001](http://\:30001) in your browser, where 30001 is the port number defined in your service. \ No newline at end of file diff --git a/machine-learning-ui/machine-learning-ui-deployment.yaml b/machine-learning-ui/machine-learning-ui-deployment.yaml new file mode 100644 index 0000000..973c705 --- /dev/null +++ b/machine-learning-ui/machine-learning-ui-deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: v1 +kind: Service +metadata: + name: ml-notebook + labels: + app: ml-notebook +spec: + type: NodePort + ports: + - port: 8888 + targetPort: 8888 + nodePort: 30001 + name: jupyter + selector: + app: ml-notebook + +--- +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + name: ml-notebook + labels: + app: ml-notebook +spec: + selector: + matchLabels: + app: ml-notebook + template: + metadata: + labels: + app: ml-notebook + spec: + containers: + - name: jupyter + image: "docker.io/clearlinux/machine-learning-ui" + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8888 + name: jupyter