* feat: update example notebook servers * docs: update example notebook servers readme * feat: update code-server notebook image start args * docs: update links to use kubeflow/kubeflow repo |
||
|---|---|---|
| .. | ||
| base | ||
| codeserver | ||
| codeserver-python | ||
| jupyter | ||
| jupyter-pytorch | ||
| jupyter-pytorch-cuda | ||
| jupyter-pytorch-cuda-full | ||
| jupyter-pytorch-full | ||
| jupyter-scipy | ||
| jupyter-tensorflow | ||
| jupyter-tensorflow-cuda | ||
| jupyter-tensorflow-cuda-full | ||
| jupyter-tensorflow-full | ||
| rstudio | ||
| rstudio-tidyverse | ||
| Makefile | ||
| OWNERS | ||
| README.md | ||
| common.mk | ||
| image-flow-chart.png | ||
README.md
Example Notebook Servers
These images are provided as examples, and are supported on a best-effort basis.
Contributions are greatly appreciated.
Images
This chart shows how the images are related to each other (the nodes are clickable links to the Dockerfiles):
graph TD
Base[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/base'>Base</a>] --> Jupyter[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter'>Jupyter</a>]
Base --> Code-Server[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/codeserver'>code-server</a>]
Base --> RStudio[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/rstudio'>RStudio</a>]
Jupyter --> PyTorch[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch'>PyTorch</a>]
Jupyter --> SciPy[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-scipy'>SciPy</a>]
Jupyter --> TensorFlow[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow'>TensorFlow</a>]
Code-Server --> Code-Server-Conda-Python[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/codeserver-python'>Conda Python</a>]
RStudio --> Tidyverse[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/rstudio-tidyverse'>Tidyverse</a>]
PyTorch --> PyTorchFull[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch-full'>PyTorch Full</a>]
TensorFlow --> TensorFlowFull[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow-full'>TensorFlow Full</a>]
Jupyter --> PyTorchCuda[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch-cuda'>PyTorch CUDA</a>]
Jupyter --> TensorFlowCuda[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow-cuda'>TensorFlow CUDA</a>]
PyTorchCuda --> PyTorchCudaFull[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-pytorch-cuda-full'>PyTorch CUDA Full</a>]
TensorFlowCuda --> TensorFlowCudaFull[<a href='https://github.com/kubeflow/kubeflow/tree/master/components/example-notebook-servers/jupyter-tensorflow-cuda-full'>TensorFlow CUDA Full</a>]
Base Images
These images provide a common starting point for Kubeflow Notebook containers.
| Dockerfile | Container Registry | Notes |
|---|---|---|
./base |
kubeflownotebookswg/base |
Common Base Image |
./codeserver |
kubeflownotebookswg/codeserver |
code-server (Visual Studio Code) |
./jupyter |
kubeflownotebookswg/jupyter |
JupyterLab |
./rstudio |
kubeflownotebookswg/rstudio |
RStudio |
Kubeflow Images
These images extend the base images with common packages used in the real world.
Custom Images
Packages installed by users after spawning a Kubeflow Notebook will only last the lifetime of the pod (unless installed into a PVC-backed directory).
To ensure packages are preserved throughout Pod restarts users will need to either:
- Build custom images that include them, or
- Ensure they are installed in a PVC-backed directory
Install Python Packages
You may extend one of the images and install any pip or conda packages your Kubeflow Notebook users are likely to need.
As a guide, look at ./jupyter-pytorch-full/Dockerfile for a pip install ... example, and the ./rstudio-tidyverse/Dockerfile for conda install ....
NOTE:
A common cause of errors is users running
pip install --user ..., causing the home-directory (which is backed by a PVC) to contain a different or incompatible version of a package contained in/opt/conda/...
Install Linux Packages
You may extend one of the images and install any apt-get packages your Kubeflow Notebook users are likely to need.
NOTE:
Ensure you swap to
rootin the Dockerfile before runningapt-get, and swap back to$NB_USERafter.
Configure S6 Overlay
Some use-cases might require custom scripts to run during the startup of the Notebook Server container, or advanced users might want to add additional services that run inside the container (for example, an Apache or NGINX web server). To make this easy, we use the s6-overlay.
The s6-overlay differs from other init systems like tini.
While tini was created to handle a single process running in a container as PID 1, the s6-overlay is built to manage multiple processes and allows the creator of the image to determine which process failures should silently restart, and which should cause the container to exit.
Create Scripts
Scripts that need to run during the startup of the container can be placed in /etc/cont-init.d/, and are executed in ascending alphanumeric order.
An example of a startup script can be found in ./rstudio/s6/cont-init.d/02-rstudio-env-fix.
This script uses the with-contenv helper so that environment variables (passed to container) are available in the script.
The purpose of this script is to snapshot any KUBERNETES_* environment variables into the Renviron.site at pod startup, as without these variables kubectl does not work.
Create Services
Extra services to be monitored by s6-overlay should be placed in their own folder under /etc/services.d/ containing a script called run and optionally a finishing script finish.
For more information about the run and finish scripts, please see the s6-overlay documentation.
An example of a service can be found in the run script of jupyter/s6/services.d/jupyterlab which is used to start JupyterLab itself.
Run Services As Root
There may be cases when you need to run a service as root, to do this, you can change the Dockerfile to have USER root at the end, and then use s6-setuidgid to run the user-facing services as $NB_USER.
NOTE:
Our example images run
s6-overlayas$NB_USER(notroot), meaning any files or scripts related tos6-overlaymust be owned by the$NB_USERuser to successfully run.
Troubleshooting
Jupyter
Kernel stuck in connecting state:
This is a problem that occurs from time to time and is not a Kubeflow problem, but rather a browser. It can be identified by looking in the browser error console, which will show errors regarding the websocket not connecting. To solve the problem, please restart your browser or try using a different browser.