Skip to content

Commit 5ad6019

Browse files
update Kubeflow Notebooks docs (#3003)
1 parent dbf5350 commit 5ad6019

13 files changed

+340
-539
lines changed

content/en/_redirects

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ docs/started/requirements/ /docs/started/getting-started/
161161
/docs/reference/pytorchjob/* /docs/components/training
162162
/docs/reference/tfjob/* /docs/components/training
163163

164+
# Cleanup of Notebooks Docs
165+
/docs/components/notebooks/custom-notebook /docs/components/notebooks/container-images
166+
/docs/components/notebooks/setup /docs/components/notebooks/quickstart-guide
167+
/docs/components/notebooks/troubleshoot /docs/components/notebooks/troubleshooting
168+
/docs/components/notebooks/why-use-jupyter-notebook /docs/components/notebooks/overview
169+
164170
# ===============
165171
# IMPORTANT NOTE:
166172
# Catch-all redirects should be added at the end of this file as redirects happen from top to bottom
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
title = "Notebook Servers"
3-
description = "Using Jupyter notebooks in Kubeflow"
2+
title = "Kubeflow Notebooks"
3+
description = "Documentation for Kubeflow Notebooks"
44
weight = 10
55
+++
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
+++
2+
title = "Container Images"
3+
description = "About Container Images for Kubeflow Notebooks"
4+
weight = 30
5+
6+
+++
7+
Kubeflow Notebooks natively supports three types of notebooks, [JupyterLab](https://github.com/jupyterlab/jupyterlab), [RStudio](https://github.com/rstudio/rstudio), and [Visual Studio Code (code-server)](https://github.com/cdr/code-server), but any web-based IDE should work.
8+
Notebook servers run as containers inside a Kubernetes Pod, which means the type of IDE (and which packages are installed) is determined by the Docker image you pick for your server.
9+
10+
## Images
11+
12+
We provide a number of [example container images](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers) to get you started.
13+
14+
### Base Images
15+
16+
These images provide a common starting point for Kubeflow Notebook containers.
17+
See [custom images](#custom-images) to learn how to extend them with your own packages.
18+
19+
Dockerfile | Registry | Notes
20+
--- | --- | ---
21+
[base](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/base) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/base:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/base) | common base image
22+
[codeserver](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/codeserver) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/codeserver:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/codeserver) | base [code-server](https://github.com/cdr/code-server) (Visual Studio Code) image
23+
[jupyter](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter) | base [JupyterLab](https://github.com/jupyterlab/jupyterlab) image
24+
[rstudio](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/rstudio) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/rstudio:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/rstudio) | base [RStudio](https://github.com/rstudio/rstudio) image
25+
26+
### Full Images
27+
28+
These images extend the [base images](#base-images) with common packages used by Data Scientists and ML Engineers.
29+
30+
Dockerfile | Registry | Notes
31+
--- | --- | ---
32+
[codeserver-python](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/codeserver-python) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/codeserver-python:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/codeserver-python) | code-server (Visual Studio Code) + Conda Python
33+
[jupyter-pytorch (CPU)](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-pytorch:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-pytorch) | JupyterLab + PyTorch (CPU)
34+
[jupyter-pytorch (CUDA)](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-pytorch-cuda:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-pytorch-cuda) | JupyterLab + PyTorch (CUDA)
35+
[jupyter-pytorch-full (CPU)](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch-full) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-pytorch-full:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-pytorch-full) | JupyterLab + PyTorch (CPU) + [common](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch-full/requirements.txt) packages
36+
[jupyter-pytorch-full (CUDA)](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch-full) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-pytorch-cuda-full:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-pytorch-cuda-full) | JupyterLab + PyTorch (CUDA) + [common](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch-full/requirements.txt) packages
37+
[jupyter-scipy](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-scipy) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-scipy:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-scipy) | JupyterLab + [SciPy](https://www.scipy.org/) packages
38+
[jupyter-tensorflow (CPU)](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-tensorflow:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-tensorflow) | JupyterLab + TensorFlow (CPU)
39+
[jupyter-tensorflow (CUDA)](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-tensorflow-cuda:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-tensorflow-cuda) | JupyterLab + TensorFlow (CUDA)
40+
[jupyter-tensorflow-full (CPU)](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow-full) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-tensorflow-full:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-tensorflow-full) | JupyterLab + TensorFlow (CPU) + [common](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow-full/requirements.txt) packages
41+
[jupyter-tensorflow-full (CUDA)](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow-full) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-tensorflow-cuda-full:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/jupyter-tensorflow-cuda-full) | JupyterLab + TensorFlow (CUDA) + [common](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow-full/requirements.txt) packages
42+
[rstudio-tidyverse](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/rstudio-tidyverse) | [`public.ecr.aws/j1r0q0g6/notebooks/notebook-servers/rstudio-tidyverse:{TAG}`](https://gallery.ecr.aws/j1r0q0g6/notebooks/notebook-servers/rstudio-tidyverse) | RStudio + [Tidyverse](https://www.tidyverse.org/) packages
43+
44+
### Image Dependency Chart
45+
46+
This flow-chart shows how our notebook container images depend on each other.
47+
48+
<img src="/docs/images/notebook-container-image-chart.png"
49+
alt="A flow-chart showing how notebook container images depend on each other"
50+
class="mt-3 mb-3 border border-info rounded">
51+
52+
## Custom Images
53+
54+
Packages installed by users __after spawning__ a Kubeflow Notebook will only last the lifetime of the pod (unless installed into a PVC-backed directory).
55+
56+
To ensure packages are preserved throughout Pod restarts users will need to either:
57+
1. [Build custom images that include them](https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers#custom-images), or
58+
2. Ensure they are installed in a PVC-backed directory
59+
60+
### Image Requirements
61+
62+
For Kubeflow Notebooks to work with a container image, the image must:
63+
- expose an HTTP interface on port `8888`:
64+
- kubeflow sets an environment variable `NB_PREFIX` at runtime with the URL path we expect the container be listening under
65+
- kubeflow uses IFrames, so ensure your application sets `Access-Control-Allow-Origin: *` in HTTP response headers
66+
- run as a user called `jovyan`:
67+
- the home directory of `jovyan` should be `/home/jovyan`
68+
- the UID of `jovyan` should be `1000`
69+
- start successfully with an empty PVC mounted at `/home/jovyan`:
70+
- kubeflow mounts a PVC at `/home/jovyan` to keep state across Pod restarts
71+
72+
## Next steps
73+
74+
- Use your container image by specifying it when spawning your notebook server.
75+
(See the [quickstart guide](/docs/components/notebooks/quickstart-guide/).)

content/en/docs/components/notebooks/custom-notebook.md

Lines changed: 0 additions & 85 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
+++
2+
title = "Jupyter TensorFlow Examples"
3+
description = "Examples using Jupyter and TensorFlow in Kubeflow Notebooks"
4+
weight = 40
5+
6+
+++
7+
8+
## Mnist Example
9+
10+
(adapted from [tensorflow/tensorflow - mnist_softmax.py](https://github.com/tensorflow/tensorflow/blob/r1.4/tensorflow/examples/tutorials/mnist/mnist_softmax.py))
11+
12+
1. When creating your notebook server choose a [container image](/docs/components/notebooks/container-images/) which has Jupyter and TensorFlow installed.
13+
14+
2. Use Jupyter's interface to create a new **Python 3** notebook.
15+
16+
3. Copy the following code and paste it into your notebook:
17+
18+
```python
19+
from tensorflow.examples.tutorials.mnist import input_data
20+
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
21+
22+
import tensorflow as tf
23+
24+
x = tf.placeholder(tf.float32, [None, 784])
25+
26+
W = tf.Variable(tf.zeros([784, 10]))
27+
b = tf.Variable(tf.zeros([10]))
28+
29+
y = tf.nn.softmax(tf.matmul(x, W) + b)
30+
31+
y_ = tf.placeholder(tf.float32, [None, 10])
32+
cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))
33+
34+
train_step = tf.train.GradientDescentOptimizer(0.05).minimize(cross_entropy)
35+
36+
sess = tf.InteractiveSession()
37+
tf.global_variables_initializer().run()
38+
39+
for _ in range(1000):
40+
batch_xs, batch_ys = mnist.train.next_batch(100)
41+
sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})
42+
43+
correct_prediction = tf.equal(tf.argmax(y,1), tf.argmax(y_,1))
44+
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
45+
print("Accuracy: ", sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}))
46+
```
47+
48+
4. Run the code. You should see a number of `WARNING` messages from TensorFlow, followed by a line showing a training accuracy something like this:
49+
50+
```
51+
Accuracy: 0.9012
52+
```
53+
54+
## Next steps
55+
56+
- See a [simple example](https://github.com/kubeflow/examples/tree/master/pipelines/simple-notebook-pipeline) of creating Kubeflow pipelines in a Jupyter notebook.
57+
- Build machine-learning pipelines with the [Kubeflow Pipelines SDK](/docs/components/pipelines/sdk/sdk-overview/).
58+
- Learn the advanced features available from a Kubeflow notebook, such as [submitting Kubernetes resources](/docs/components/notebooks/submit-kubernetes/) or [building Docker images](/docs/components/notebooks/custom-notebook/).
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
+++
2+
title = "Overview"
3+
description = "An overview of Kubeflow Notebooks"
4+
weight = 5
5+
6+
+++
7+
{{% stable-status %}}
8+
9+
## What is Kubeflow Notebooks?
10+
11+
Kubeflow Notebooks provides a way to run web-based development environments inside your Kubernetes cluster by running them inside Pods.
12+
13+
Some key features include:
14+
- Native support for [JupyterLab](https://github.com/jupyterlab/jupyterlab), [RStudio](https://github.com/jupyterlab/jupyterlab), and [Visual Studio Code (code-server)](https://github.com/cdr/code-server).
15+
- Users can create notebook containers directly in the cluster, rather than locally on their workstations.
16+
- Admins can provide standard notebook images for their organization with required packages pre-installed.
17+
- Access control is managed by Kubeflow's RBAC, enabling easier notebook sharing across the organization.
18+
19+
## Next steps
20+
21+
- Get started with Kubeflow Notebooks using the [quickstart guide](/docs/components/notebooks/quickstart-guide/).
22+
- Learn how to create your own [container images](/docs/components/notebooks/container-images/).

0 commit comments

Comments
 (0)