Skip to content

Conversation

TheCoder2010-create
Copy link

Kubeflow Pipelines lacked a reusable component for packaging trained model artifacts as ModelKits and pushing them to OCI-compliant registries. This gap made it difficult to standardize model packaging and automate model delivery to registries within Kubeflow workflows.

What Has Been Added
Reusable Kubeflow Pipeline Component: A new component that:
Extracts training parameters, pipeline run ID, experiment name, and metrics from Kubeflow ML Metadata.
Packages model artifacts using the ModelKit format.
Pushes the packaged ModelKit to any OCI-compliant registry.
Supports authentication via Kubernetes secrets or IRSA/Workload Identity for cloud environments.
Component Implementation:
component.py: Python script for metadata extraction, packaging, and push logic.

Dockerfile: Container image definition with all dependencies.
component.yaml: KFP component specification for easy integration.
This addition enables seamless, standardized, and secure model packaging and registry integration for Kubeflow users.

@TheCoder2010-create TheCoder2010-create changed the title Add Kubeflow Pipeline component for ModelKit packaging and OCI push Added Kubeflow Pipeline component for ModelKit packaging and OCI push Sep 26, 2025
@bmicklea
Copy link
Collaborator

Could you drop a Markdown file or other notes here that we can use to create docs for this? Or create a companion docs PR?

@TheCoder2010-create
Copy link
Author

Could you drop a Markdown file or other notes here that we can use to create docs for this? Or could you create a companion docs PR?

KFP ModelKit Component

Overview

This Kubeflow Pipeline (KFP) component enables packaging a ModelKit model and pushing it to an OCI (Open Container Initiative) registry. It is designed to be used as a step in automated ML pipelines, making it easy to build, package, and distribute models using ModelKit within Kubeflow.

Files

  • component.py: Python script implementing the component logic.
  • component.yaml: KFP component specification for pipeline integration.
  • Dockerfile: Container definition for the component runtime environment.

Usage

  1. Build the Docker image:
    docker build -t <your-repo>/kfp-modelkit-component:latest .
  2. Push the image to your registry:
    docker push <your-repo>/kfp-modelkit-component:latest
  3. Use in a KFP pipeline:
    • Reference component.yaml in your pipeline definition.
    • Configure input parameters as needed (see below).

Inputs & Parameters

Refer to component.yaml for the full list of parameters. Typical parameters include:

  • Model source path
  • Model name and version
  • OCI registry URL and credentials
  • Additional packaging options

Example Pipeline Step

import kfp
from kfp.components import load_component_from_file

modelkit_op = load_component_from_file('component.yaml')

# Example usage in a pipeline
def my_pipeline(...):
    modelkit_op(
        model_path='path/to/model',
        model_name='my-model',
        version='1.0.0',
        registry_url='oci://my-registry',
        # ...other params...
    )

Notes

  • Ensure all required environment variables and credentials are available at runtime.
  • The component is designed for use with ModelKit and OCI-compliant registries.
  • For advanced usage, customize component.py or the Dockerfile as needed.

@bmicklea bmicklea linked an issue Sep 29, 2025 that may be closed by this pull request
Copy link
Contributor

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TheCoder2010-create for the contribution! This PR appears to be incomplete at the moment, but is a good starting point for implementing something like this. We still need to install the Kit CLI into the resulting container and use the correct sequence of commands to create a ModelKit.

You note in your PR description

Supports authentication via Kubernetes secrets or IRSA/Workload Identity for cloud environments.

However I don't see this referenced in the added files; is this something that's automatically done by the libraries you are using?

# If ModelKit is only available via binary, add COPY or curl/wget here
# For now, placeholder:
RUN pip install --no-cache-dir ml-metadata kfp
# TODO: Add ModelKit CLI installation here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can potentially reuse the standard KitOps image and copy the binary out of it into this image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ModelKit Push Component for Kubeflow Pipelines

3 participants