dhi.io/kubeflow-tensorboards-web-app
Web UI and REST backend for creating, listing and deleting Kubeflow Tensorboard custom resources in a user's profile namespace.
All examples in this guide use the public image. If you've mirrored the repository for your own use (for example, to your Docker Hub namespace), update your commands to reference the mirrored image instead of the public one.
For example:
dhi.io/kubeflow-tensorboards-web-app:<tag><your-namespace>/dhi-kubeflow-tensorboards-web-app:<tag>For the examples, you must first use docker login dhi.io to authenticate to the registry to pull the images.
This image is the Kubeflow Tensorboards web app: the web UI and REST API that list, create, and delete Tensorboard
custom resources (tensorboard.kubeflow.org) in a user's profile namespace. It replaces
ghcr.io/kubeflow/notebooks/tensorboards-web-app. The TensorBoard servers themselves are started by the Tensorboard
controller, a separate Kubeflow component. For the full Kubeflow setup, see the
Kubeflow Notebooks documentation.
Tags without a distro suffix, such as 1 or 1.11.1, are Debian 13. Alpine 3.24 tags include -alpine or
-alpine3.24, for example 1-alpine or 1.11.1-alpine3.24.
The entrypoint runs gunicorn with three workers on port 5000. The backend loads its Kubernetes client configuration when
each worker starts: the in-cluster service account when it runs in a pod, otherwise the kubeconfig named by
KUBECONFIG. Without either, the workers fail to boot and the container exits. Every request except the health and
metrics endpoints must carry the user's identity in the kubeflow-userid header, which the Kubeflow gateway normally
adds.
Mount a kubeconfig for your cluster and run:
docker run -d --name tensorboards-web-app -p 5000:5000 \
-v "$PWD/kubeconfig.yaml:/kube/config:ro" \
-e KUBECONFIG=/kube/config \
-e APP_SECURE_COOKIES=False \
dhi.io/kubeflow-tensorboards-web-app:<tag>
Replace <tag> with a published tag, such as 1.11.1-debian13 or 1.11.1-alpine3.24. The kubeconfig file must be
readable by UID 65532; a file with mode 0600 owned by your user makes every worker fail with
Permission denied: '/kube/config'. The API server address in the kubeconfig must be reachable from inside the
container.
Request the UI as a user:
curl -H 'kubeflow-userid: [email protected]' http://localhost:5000/
Without the header, the app answers 401 with {"log":"No user detected.", ...}. /healthz/liveness,
/healthz/readiness, and /metrics answer 200 without it.
API calls go to the cluster, and the app checks each one with a SubjectAccessReview for the user in the header. This lists the Tensorboards in a namespace where that user has access:
curl -H 'kubeflow-userid: [email protected]' http://localhost:5000/api/namespaces/<namespace>/tensorboards
None of these is set in the image. true and false values are case-insensitive.
| Variable | Description | Default |
|---|---|---|
KUBECONFIG | Path to a kubeconfig, used when there is no in-cluster service account. | Unset |
APP_PREFIX | Path the UI is published under. Sets the page's <base href> and the XSRF-TOKEN cookie path. Routes stay at /, so the proxy must strip the prefix. | / |
APP_SECURE_COOKIES | When true, the XSRF-TOKEN cookie is marked Secure. Set it to false when you serve the UI over plain HTTP, or browsers drop the cookie and create and delete requests fail with 403. | true |
USERID_HEADER | Request header that carries the user's identity. | kubeflow-userid |
USERID_PREFIX | String removed from the header value to get the user name, wherever it appears in the value. | : |
APP_DISABLE_AUTH | When true, skips the user header check and the SubjectAccessReview. | false |
METRICS | Any non-empty value serves Prometheus metrics at /metrics. Set it to an empty string to turn metrics off. | Metrics on |
The following overlay uses the upstream overlays/istio kustomization at the v1.11.1 tag, which is how Kubeflow
deploys the app. It creates the Deployment, Service, ServiceAccount, and RBAC rules in the kubeflow namespace, and an
Istio VirtualService on kubeflow-gateway that routes /tensorboards/ to the app and rewrites the prefix to /.
That matches the upstream APP_PREFIX=/tensorboards. The overlay replaces the upstream image with this image, and runs
the container as uid and gid 65532, the image's numeric user and group:
# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/kubeflow/notebooks/components/crud-web-apps/tensorboards/manifests/overlays/istio?ref=v1.11.1
images:
- name: ghcr.io/kubeflow/notebooks/tensorboards-web-app
newName: dhi.io/kubeflow-tensorboards-web-app
newTag: 1.11.1-debian13
patches:
- target:
kind: Deployment
name: tensorboards-web-app-deployment
patch: |-
- op: replace
path: /spec/template/spec/containers/0/securityContext/runAsUser
value: 65532
- op: add
path: /spec/template/spec/containers/0/securityContext/runAsGroup
value: 65532
Apply it with:
kubectl apply -k .
Your cluster must be able to pull from dhi.io, for example through an image pull secret. The cluster also needs the
Istio CRDs, the Tensorboard CRD, and the Tensorboard controller, which a Kubeflow installation provides. The upstream
RBAC lets the app's service account create SubjectAccessReviews and manage Tensorboards and PVCs. The
kubeflow-tensorboard-ui-edit and kubeflow-tensorboard-ui-view ClusterRoles aggregate into Kubeflow's kubeflow-edit
and kubeflow-view roles, so users get access through their profile namespace. The upstream Deployment sets
runAsUser: 1000 and no group; the overlay sets both to 65532 and keeps the upstream runAsNonRoot: true.
gunicorn writes worker heartbeat files to /tmp, and it fails to start if /tmp is not writable. It also creates a
control socket under $HOME, and logs a non-fatal Control server error if it cannot. To set
readOnlyRootFilesystem: true, mount an emptyDir on /tmp and point HOME at it. Add this entry to the patches
list of the overlay from the previous section:
- target:
kind: Deployment
name: tensorboards-web-app-deployment
patch: |-
- op: add
path: /spec/template/spec/containers/0/securityContext/readOnlyRootFilesystem
value: true
- op: add
path: /spec/template/spec/containers/0/env/-
value:
name: HOME
value: /tmp
- op: add
path: /spec/template/spec/containers/0/volumeMounts
value:
- name: tmp
mountPath: /tmp
- op: add
path: /spec/template/spec/volumes
value:
- name: tmp
emptyDir: {}
Arguments after the image name are appended to the gunicorn command line, and a later option overrides the built-in one. This runs one worker instead of three:
docker run -d --name tensorboards-web-app -p 5000:5000 \
-v "$PWD/kubeconfig.yaml:/kube/config:ro" \
-e KUBECONFIG=/kube/config \
-e APP_SECURE_COOKIES=False \
dhi.io/kubeflow-tensorboards-web-app:<tag> -w 1
To replace the whole command line, set the entrypoint to /usr/bin/gunicorn and pass every argument. The working
directory is /src, where gunicorn finds entrypoint:app:
docker run -d --name tensorboards-web-app -p 5000:5000 \
-v "$PWD/kubeconfig.yaml:/kube/config:ro" \
-e KUBECONFIG=/kube/config \
--entrypoint /usr/bin/gunicorn \
dhi.io/kubeflow-tensorboards-web-app:<tag> \
-w 2 --bind 0.0.0.0:5000 --timeout 60 --access-logfile - entrypoint:app
/bin/bash -c "gunicorn -w 3 --bind 0.0.0.0:5000 --access-logfile - entrypoint:app", and it ignores any arguments you
add. This image runs the same gunicorn command directly, without a shell, so added arguments reach gunicorn (see
Change gunicorn options). A Kubernetes command or Compose entrypoint that wraps
gunicorn in bash -c or sh -c fails on runtime tags; pass gunicorn and its arguments directly instead./usr/lib/kubeflow-tensorboards-web-app/.venv/bin/python. The python3 on PATH is a bare interpreter without the
app's packages, so a command such as python3 entrypoint.py fails with No module named 'kubeflow'. Use the full
interpreter path instead.nonroot (uid and gid 65532); dev tags run as root. Other UIDs also work. When the UID has no home directory in
the image, gunicorn logs Control server error: [Errno 13] Permission denied: '/.gunicorn' and keeps serving; set
HOME to a writable directory such as /tmp to avoid it./tmp and, for the gunicorn control socket, $HOME. With a read-only root
filesystem, mount a writable /tmp (see
Run with a read-only root filesystem); without it the container exits with
No usable temporary directory found.SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt, the system CA bundle.dev tags include a shell and apt-get (Debian) or
apk (Alpine).The -fips and -fips-dev tags, such as 1.11.1-debian13-fips and 1.11.1-alpine3.24-fips, are FIPS builds. They set
OPENSSL_CONF and OPENSSL_MODULES so that OpenSSL loads its FIPS provider and selects FIPS-approved implementations
by default. The backend's TLS connections and the Python cryptography package use that OpenSSL, so it refuses
non-approved algorithms such as MD5. The image metadata declares fips-compliant: true and stig-certified: true. Use
these tags when your environment requires FIPS-compliant builds.
Docker Hardened Images come in different variants depending on their intended use. Image variants are identified by their tag.
Runtime variants are designed to run your application in production. These images are intended to be used either directly or as the FROM image in the final stage of a multi-stage build. These images typically:
Build-time variants typically include dev in the tag name and are intended for use in the first stage of a
multi-stage Dockerfile. These images typically:
FIPS variants include fips in the variant name and tag. They come in both runtime and build-time variants. These
variants use cryptographic modules that have been validated under FIPS 140, a U.S. government standard for secure
cryptographic operations. For example, usage of MD5 fails in FIPS variants.
To view the image variants and get more information about them, select the Tags tab for this repository, and then select a tag.
To migrate your application to a Docker Hardened Image, you must update your Dockerfile. At minimum, you must update the base image in your existing Dockerfile to a Docker Hardened Image. This and a few other common changes are listed in the following table of migration notes.
| Item | Migration note |
|---|---|
| Base image | Replace your base images in your Dockerfile with a Docker Hardened Image. |
| Package management | Non-dev images, intended for runtime, don't contain package managers. Use package managers only in images with a dev tag. |
| Non-root user | By default, non-dev images, intended for runtime, run as the nonroot user. Ensure that necessary files and directories are accessible to the nonroot user. |
| Multi-stage build | Utilize images with a dev tag for build stages and non-dev images for runtime. For binary executables, use a static image for runtime. |
| TLS certificates | Docker Hardened Images contain standard TLS certificates by default. There is no need to install TLS certificates. |
| Ports | Non-dev hardened images run as a nonroot user by default. As a result, applications in these images can't bind to privileged ports (below 1024) when running in Kubernetes or in Docker Engine versions older than 20.10. To avoid issues, configure your application to listen on port 1025 or higher inside the container. |
| Entry point | Docker Hardened Images may have different entry points than images such as Docker Official Images. Inspect entry points for Docker Hardened Images and update your Dockerfile if necessary. |
| No shell | By default, non-dev images, intended for runtime, don't contain a shell. Use dev images in build stages to run shell commands and then copy artifacts to the runtime stage. |
The following steps outline the general migration process.
Find hardened images for your app.
A hardened image may have several variants. Inspect the image tags and find the image variant that meets your needs.
Update the base image in your Dockerfile.
Update the base image in your application's Dockerfile to the hardened image you found in the previous step. For
framework images, this is typically going to be an image tagged as dev because it has the tools needed to install
packages and dependencies.
For multi-stage Dockerfiles, update the runtime image in your Dockerfile.
To ensure that your final image is as minimal as possible, you should use a multi-stage build. All stages in your
Dockerfile should use a hardened image. While intermediary stages will typically use images tagged as dev, your
final runtime stage should use a non-dev image variant.
Install additional packages
Docker Hardened Images contain minimal packages in order to reduce the potential attack surface. You may need to install additional packages in your Dockerfile. Inspect the image variants to identify which packages are already installed.
Only images tagged as dev typically have package managers. You should use a multi-stage Dockerfile to install the
packages. Install the packages in the build stage that uses a dev image. Then, if needed, copy any necessary
artifacts to the runtime stage that uses a non-dev image.
For Alpine-based images, you can use apk to install packages. For Debian-based images, you can use apt-get to
install packages.
The following are common issues that you may encounter during migration.
The hardened images intended for runtime don't contain a shell nor any tools for debugging. The recommended method for debugging applications built with Docker Hardened Images is to use Docker Debug to attach to these containers. Docker Debug provides a shell, common debugging tools, and lets you install other tools in an ephemeral, writable layer that only exists during the debugging session.
By default image variants intended for runtime, run as the nonroot user. Ensure that necessary files and directories are accessible to the nonroot user. You may need to copy files to different directories or change permissions so your application running as the nonroot user can access them.
Non-dev hardened images run as a nonroot user by default. As a result, applications in these images can't bind to
privileged ports (below 1024) when running in Kubernetes or in Docker Engine versions older than 20.10. To avoid issues,
configure your application to listen on port 1025 or higher inside the container, even if you map it to a lower port on
the host. For example, docker run -p 80:8080 my-image will work because the port inside the container is 8080, and
docker run -p 80:81 my-image won't work because the port inside the container is 81.
By default, image variants intended for runtime don't contain a shell. Use dev images in build stages to run shell
commands and then copy any necessary artifacts into the runtime stage. In addition, use Docker Debug to debug containers
with no shell.
Docker Hardened Images may have different entry points than images such as Docker Official Images. Use docker inspect
to inspect entry points for Docker Hardened Images and update your Dockerfile if necessary.