Skip to content

Commit

Permalink
TensorFlow notebook (helm#4990)
Browse files Browse the repository at this point in the history
* [incubator/tensorflow-notebook] add tensorflow notebook and tensorboard

add hook

* update helmignore

* add home

* change Always to IfNotPresent

* move to stable
  • Loading branch information
cheyang authored and k8s-ci-robot committed Apr 19, 2018
1 parent 0cbc762 commit e9cadca
Show file tree
Hide file tree
Showing 11 changed files with 306 additions and 0 deletions.
22 changes: 22 additions & 0 deletions stable/tensorflow-notebook/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.jpg
*~
# Various IDEs
.project
.idea/
*.tmproj
12 changes: 12 additions & 0 deletions stable/tensorflow-notebook/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
description: A Helm chart for tensorflow notebook and tensorboard
name: tensorflow-notebook
version: 0.1.0
appVersion: 1.6.0
sources:
- https://github.com/tensorflow/tensorflow
- https://github.com/jupyter
home: https://www.tensorflow.org
maintainers:
- name: cheyang
email: cheyang@163.com
93 changes: 93 additions & 0 deletions stable/tensorflow-notebook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# TensorFlow Notebook Helm Chart

TensorFlow is an open source software library for numerical computation using data flow graphs, and tensorboard is the tool visualizing TensorFlow programs. Using Jupyter notebook to get into TensorFlow and develop models is the great way for data scientist. With these three tools you are able to start your machine learning work in two minutes.

- https://www.tensorflow.org
- https://www.tensorflow.org/programmers_guide/summaries_and_tensorboard
- http://jupyter.org/

## Prerequisites

- Kubernetes cluster v1.8+

## Chart Details

This chart will deploy the followings:

- Jupyter Notebook with TensorFlow
- Tensorboard

## Installing the Chart

* To install the chart with the release name `notebook`:

```bash
$ helm install --name notebook stable/tensorflow-notebook
```

* To install with custom values via file :

```
$ helm install --values values.yaml --name notebook stable/tensorflow-notebook
```

Below is an example of the custom value file values.yaml with GPU support.

```
jupyter:
image:
repository: tensorflow/tensorflow
tag: 1.6.0-devel-gpu
pullPolicy: IfNotPresent
password: tensorflow
resources:
limits:
nvidia.com/gpu: 1
requests:
nvidia.com/gpu: 1
tensorboard:
image:
repository: tensorflow/tensorflow
tag: 1.6.0-devel
pullPolicy: IfNotPresent
service:
type: LoadBalancer
```


## Run TensorFlow Example [tensorboard_basic.ipynb](https://github.com/cheyang/TensorFlow-Examples/blob/master/notebooks/4_Utils/tensorboard_basic.ipynb)

> Notice: you should set the log_path `/output/training_logs`
![](jupyter.jpg)

## Check the TensorBoard

![](tensorboard.jpg)

## Uninstalling the Chart

* To uninstall/delete the `notebook` deployment:

```bash
$ helm delete notebook
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following tables lists the configurable parameters of the Service Tensorflow Development
chart and their default values.

| Parameter | Description | Default |
|-----------|-------------|---------|
| `jupyter.image.repository` | TensorFlow Development image repository | `tensorflow/tensorflow` |
| `jupyter.image.tag` | TensorFlow Development image tag | `1.5.0-devel-gpu` |
| `jupyter.password` | The password to access jupyter | `mytest` |
| `jupyter.image.pullPolicy` | image pullPolicy for the jupyter | `IfNotPresent` |
| `tensorboard.image.repository` | TensorFlow Development image repository | `tensorflow/tensorflow` |
| `tensorboard.image.tag` | TensorFlow Development image tag | `1.5.0-devel-gpu` |
| `tensorboard.image.pullPolicy` | image pullPolicy for the tensorboard | `IfNotPresent` |
| `resources` | Set the resource to be allocated and allowed for the Pods | `{}` |
| `service.type` | service type | `LoadBalancer` |
Binary file added stable/tensorflow-notebook/jupyter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions stable/tensorflow-notebook/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
1. Get the application URL by running these commands:

{{- if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "tensorflow-notebook.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "tensorflow-notebook.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo notebook_url=http://$SERVICE_IP:8888
echo tensorboard_url=http://$SERVICE_IP:6006
{{- end }}
32 changes: 32 additions & 0 deletions stable/tensorflow-notebook/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "tensorflow-notebook.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "tensorflow-notebook.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "tensorflow-notebook.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
76 changes: 76 additions & 0 deletions stable/tensorflow-notebook/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "tensorflow-notebook.fullname" . }}
labels:
app: {{ template "tensorflow-notebook.name" . }}
chart: {{ template "tensorflow-notebook.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
selector:
matchLabels:
app: {{ template "tensorflow-notebook.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "tensorflow-notebook.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: jupyter
image: "{{ .Values.jupyter.image.repository }}:{{ .Values.jupyter.image.tag }}"
imagePullPolicy: {{ .Values.jupyter.image.pullPolicy }}
ports:
- containerPort: 8888
name: jupyter
command:
- jupyter
args:
- notebook
- --allow-root
env:
- name: PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "tensorflow-notebook.fullname" . }}
key: password
livenessProbe:
httpGet:
path: /
port: 8888
readinessProbe:
httpGet:
path: /
port: 8888
volumeMounts:
- mountPath: /output/training_logs
name: training-logs-volume
- name: tensorboard
image: "{{ .Values.tensorboard.image.repository }}:{{ .Values.tensorboard.image.tag }}"
imagePullPolicy: {{ .Values.tensorboard.image.pullPolicy }}
ports:
- containerPort: 6006
name: tensorboard
command:
- tensorboard
args:
- --logdir
- /output/training_logs
- --host
- 0.0.0.0
livenessProbe:
httpGet:
path: /
port: 6006
readinessProbe:
httpGet:
path: /
port: 6006
volumeMounts:
- mountPath: /output/training_logs
name: training-logs-volume
volumes:
- name: training-logs-volume
emptyDir: {}
14 changes: 14 additions & 0 deletions stable/tensorflow-notebook/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "tensorflow-notebook.fullname" . }}
labels:
app: {{ template "tensorflow-notebook.name" . }}
chart: {{ template "tensorflow-notebook.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
"helm.sh/hook": pre-install,pre-upgrade
type: Opaque
data:
password: {{ .Values.jupyter.password | b64enc | quote }}
23 changes: 23 additions & 0 deletions stable/tensorflow-notebook/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "tensorflow-notebook.fullname" . }}
labels:
app: {{ template "tensorflow-notebook.name" . }}
chart: {{ template "tensorflow-notebook.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: 6006
targetPort: tensorboard
protocol: TCP
name: tensorboard
- port: 8888
targetPort: jupyter
protocol: TCP
name: jupyter
selector:
app: {{ template "tensorflow-notebook.name" . }}
release: {{ .Release.Name }}
Binary file added stable/tensorflow-notebook/tensorboard.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions stable/tensorflow-notebook/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Default values for ack-tensorflow-dev.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
jupyter:
image:
repository: tensorflow/tensorflow
tag: 1.6.0-devel
pullPolicy: IfNotPresent
password: tensorflow
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# nvidia.com/gpu: 1
# requests:
# cpu: 100m
# memory: 128Mi
# nvidia.com/gpu: 1
tensorboard:
image:
repository: tensorflow/tensorflow
tag: 1.6.0-devel
pullPolicy: IfNotPresent
service:
type: LoadBalancer

0 comments on commit e9cadca

Please sign in to comment.