Skip to content

Commit

Permalink
Merge pull request #57 from nlnwa/tensorflow-jupyter
Browse files Browse the repository at this point in the history
Add tensorflow-jupyter to base/dev
  • Loading branch information
maeb authored Jun 12, 2020
2 parents c1c21fe + 742d97b commit ec4c3c6
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bases/tensorflow-jupyter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Kubernetes deployment of Tensorflow with Jupyter notebook server

## Get started

- [Tensorflow in notebooks](https://www.tensorflow.org/tensorboard/tensorboard_in_notebooks)

## Reference

1. [Tensorflow dockerfiles](https://www.tensorflow.org/install/docker)
32 changes: 32 additions & 0 deletions bases/tensorflow-jupyter/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tensorflow-jupyter
labels:
app.kubernetes.io/name: tensorflow-jupyter
app.kubernetes.io/component: tensorflow

spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: tensorflow-jupyter
app.kubernetes.io/component: tensorflow
template:
metadata:
labels:
app.kubernetes.io/name: tensorflow-jupyter
app.kubernetes.io/component: tensorflow
spec:
containers:
- name: tensorflow-jupyter
image: tensorflow/tensorflow:nightly-jupyter
imagePullPolicy: Always
ports:
- name: http-tb
containerPort: 6006
protocol: TCP
- name: http-jupyter
containerPort: 8888
protocol: TCP

6 changes: 6 additions & 0 deletions bases/tensorflow-jupyter/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- service.yaml
- deployment.yaml
21 changes: 21 additions & 0 deletions bases/tensorflow-jupyter/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: tensorflow-jupyter
labels:
app.kubernetes.io/name: tensorflow-jupyter
app.kubernetes.io/component: tensorflow
spec:
type: ClusterIP
ports:
- port: 8888
name: http-jupyter
targetPort: http-jupyter
protocol: TCP
- port: 6006
name: http-tb
targetPort: http-tb
protocol: TCP
selector:
app.kubernetes.io/name: tensorflow-jupyter
app.kubernetes.io/component: tensorflow
12 changes: 12 additions & 0 deletions dev/bases/tensorflow-jupyter/deployment_env_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tensorflow-jupyter
spec:
template:
spec:
containers:
- name: tensorflow-jupyter
env:
- name: TENSORBOARD_PROXY_URL
value: https://veidemann.local/tensorboard/
22 changes: 22 additions & 0 deletions dev/bases/tensorflow-jupyter/deployment_volume_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tensorflow-jupyter
spec:
template:
spec:
volumes:
- name: jupyter-notebooks
persistentVolumeClaim:
claimName: jupyter-notebooks
- name: jupyter-config
configMap:
name: jupyter-config
containers:
- name: tensorflow-jupyter
volumeMounts:
- name: jupyter-config
mountPath: /root/.jupyter/jupyter_notebook_config.py
subPath: jupyter_notebook_config.py
- name: jupyter-notebooks
mountPath: /tf/notebooks
20 changes: 20 additions & 0 deletions dev/bases/tensorflow-jupyter/ingressroute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: tensorflow-jupyter-ingressroute
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`veidemann.local`) && PathPrefix(`/tensorboard`)
kind: Rule
services:
- name: tensorflow-jupyter
port: 6006
- match: Host(`veidemann.local`) && PathPrefix(`/jupyter`)
kind: Rule
services:
- name: tensorflow-jupyter
port: 8888
tls: {}
10 changes: 10 additions & 0 deletions dev/bases/tensorflow-jupyter/jupyter-notebooks-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: jupyter-notebooks
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Mi
1 change: 1 addition & 0 deletions dev/bases/tensorflow-jupyter/jupyter_notebook_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c.NotebookApp.base_url = '/jupyter/'
18 changes: 18 additions & 0 deletions dev/bases/tensorflow-jupyter/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: veidemann

resources:
- ../../../bases/tensorflow-jupyter
- ingressroute.yaml
- jupyter-notebooks-pvc.yaml

patchesStrategicMerge:
- deployment_volume_patch.yaml
- deployment_env_patch.yaml

configMapGenerator:
- name: jupyter-config
files:
- jupyter_notebook_config.py

0 comments on commit ec4c3c6

Please sign in to comment.