Run Kubeflow Pipelines from a Kale Workbench
Kale is a JupyterLab extension that turns annotated notebook cells into a Kubeflow Pipelines (KFP) v2 pipeline. Use a JupyterLab WorkspaceKind built with the Kale extension; do not install Kale interactively into a running workbench because the extension and its server component must use matching versions.
TOC
PrerequisitesConfigure Kale authentication per namespaceCreate a Kale WorkspaceKindUse Kale in JupyterLabExamplesPrerequisites
- Kubeflow Pipelines is installed and its
ml-pipelineservice is available in thekubeflownamespace. - The workbench namespace is managed by a Kubeflow
Profile. This gives the namespace thekubeflow-profilelabel required by the Pipeline API NetworkPolicy. - The WorkspaceKind uses a service account that can request the projected token for
the
pipelines.kubeflow.orgaudience. - A Kale JupyterLab image has been built and published to an image registry that cluster nodes can pull from. Ask your platform administrator for the image address and tag.
Configure Kale authentication per namespace
Kale reads KFP authentication from kfp_server_config.json. Store only a token
path in the ConfigMap: the token itself stays in the projected service-account
volume and is refreshed by Kubernetes.
Create this ConfigMap in every namespace that will use the Kale WorkspaceKind.
Replace <your-namespace> with the namespace of the workbench.
Apply it with:
Create a Kale WorkspaceKind
The following excerpt shows the Kale-specific parts of a JupyterLab
WorkspaceKind. Add the usual resource options, probes, and workbench labels used
by your platform. The NB_PREFIX and NOTEBOOK_BASE_URL values must match the
Skipper route for the target cluster.
The ConfigMap is namespace-scoped. A WorkspaceKind can be cluster-scoped, but each
namespace using it must contain its own kale-kfp-server-config ConfigMap with the
matching KFP namespace value.
Apply the WorkspaceKind and create a workbench from it:
Use Kale in JupyterLab
- Open the running Kale workbench and upload a notebook.
- Open the Kale panel from the left sidebar.
- Mark cells as pipeline steps and set the pipeline and experiment names.
- Select Compile and Run. Kale compiles the notebook, uploads it to KFP, and
starts a run in the namespace configured in
kfp_server_config.json.
If Kale reports an empty identity or 401 Unauthorized, verify that
KALE_CONFIG_PATH points to the mounted ConfigMap and that the Pipeline token is
mounted at /var/run/secrets/kubeflow/pipelines/token. A reachable Pipeline health
endpoint alone is not sufficient: Kale must use that projected token to authenticate.
Examples
- Download the Iris scikit-learn pipeline notebook. It is a compact end-to-end example for testing compilation and KFP submission; its requirements file is included.
- Download the candies-sharing notebook. It is a minimal example for learning cell annotations before using a larger notebook.
The examples are copied from the upstream Kubeflow Kale repository.