Overview

5 Orchestrating ML pipelines

This chapter moves from manual, tool-by-tool ML workflows to automated, reproducible orchestration with Kubeflow Pipelines. Building on experiment tracking with MLflow and feature management with Feast, it demonstrates how to turn a batch income-classification workflow into a scalable pipeline. The focus is on expressing pipelines as code with the kfp SDK, packaging repeatable steps, and enabling parameterized, scheduled runs that improve consistency and collaboration across teams.

The core building block is the Kubeflow component: a single-responsibility task implemented in Python, containerized with Docker, and described by a YAML spec that declares typed inputs and outputs (for example, Dataset artifacts). Four reusable components illustrate the pattern end to end: reading entity IDs from MinIO, retrieving features from Feast using the cluster-facing object-store endpoint, loading a staged model from MLflow to run inference, and writing predictions back to MinIO. Artifacts flow between steps via inputPath/outputPath, ensuring clean handoffs. Design guidance emphasizes modularity, clear I/O contracts, parameterization for portability across environments, and documentation—yielding benefits in reusability, parallel team development, and isolated testing.

These components are composed into a directed acyclic graph that wires task dependencies through task.outputs. The pipeline function defines runtime parameters (for storage, feature lists, and model registry settings), is compiled to a YAML package, and is executed and tracked through the Kubeflow UI using experiments and runs. With intermediate datasets persisted in object storage, executions are reproducible and easy to audit. Overall, the chapter shows how Kubeflow Pipelines provide reliable orchestration, scaling, and tracking for batch inference workflows, setting the stage for real-time serving patterns addressed later with complementary tools.

The mental map where we are now focusing on Kubeflow pipeline orchestration(A).
Kubeflow pipeline interactions with MinIO, Feast and MLFlow. All of the intermediate datasets are stored in MinIO to be retrieved by subsequent steps. The model and features are retrieved from MinIO and Feast respectively.
Kubeflow pipeline UI that lists out all the pipelines in our account.
Kubeflow pipeline UI to create a pipeline. Need to provide a pipeline name and upload the pipeline yaml file.
Pipeline visualized by the Kubeflow pipeline UI after we upload it.
Create an experiment in Kubeflow, by providing a name and experiment description.
Create a pipeline run by providing all the pipeline arguments.
A successful Kubeflow pipeline run.

Summary

  • Orchestration is the process of running multiple complex pipelines while making sure that the pipeline steps have the data and the compute needed. The kubeflow platform offers kubeflow pipelines as a solution.
  • A component is a reusable and composable unit of work within a machine learning (ML) workflow. These components encapsulate individual tasks or steps that perform specific actions, such as data preprocessing, model training, evaluation, deployment, and more.
  • While designing components, care should be taken to keep them as independent and generic as possible, allowing for reusability, easier development, testing, and maintenance of individual pipeline stages.
  • Larger workflows can be broken down into smaller components. This approach helps create modular and easily maintainable ML pipelines from shared components.
  • Kubeflow Pipelines and task orchestrators can be used to automate, sequence, and manage machine learning workflows, ensuring the efficient execution of data preprocessing, model training, and deployment tasks. It offers SDKs to build up individual components, connecting components to a pipeline as well as pipeline deployment and execution.

FAQ

What problem does Kubeflow Pipelines solve in this chapter?Kubeflow Pipelines automates ML workflow steps—data retrieval, feature fetching, model loading, inference, and result writing—so they run reliably and repeatedly without manual coordination. It makes the batch inference process scalable, reproducible, and parameterizable.
What is a Kubeflow component and how does it execute?A Kubeflow component is a reusable, self-contained step (e.g., read data, retrieve features, run inference, write data). Each component runs in its own Kubernetes Pod using a container image you build, ensuring isolation and consistent environments.
How do I build a component from code to a usable KFP step?Follow three steps: 1) write the Python logic (e.g., read_data.py), 2) containerize it with a Dockerfile and push the image to a registry, and 3) define a component.yaml specifying inputs, outputs (artifacts like Dataset), the container image, and the command/args to run.
How does the Read Data component interact with MinIO and downstream steps?It initializes a MinIO client, downloads the input parquet (e.g., list of user IDs), and saves it to the component’s output artifact path. Declaring an output of type Dataset in component.yaml lets subsequent steps consume it as an artifact.
How are Feast features retrieved inside the pipeline?The Feature Retrieval component initializes a Feast Feature Store (using feature_store.yaml stored in MinIO), reads the entity dataframe from an input Dataset artifact, requests a configurable feature list, and writes the result to an output Dataset. For in-cluster access, the S3 endpoint is changed from localhost to the MinIO cluster service, and features are re-registered inside the cluster.
How does the Inference component load the model from MLflow and produce predictions?It sets MinIO/S3 environment variables, points MLflow to the tracking server, finds the model by name and stage, loads it with the appropriate flavor (sklearn/xgboost/tensorflow), preprocesses input features to match the training column list, computes probabilities (e.g., predict_proba), and writes predictions to an output Dataset.
How do components pass data to each other and enforce ordering?Components share artifacts through declared outputs/inputs (e.g., type Dataset). In the pipeline definition, you pass one task’s output to another’s input using task.outputs["..."]. This both wires data flow and creates an execution dependency (i.e., downstream tasks wait for upstream completion).
What does the Write Data component do and how is its input typed?It reads the inference output (an artifact) and writes a parquet file back to a MinIO bucket. In KFP v2 style, its input is declared as an Artifact (or Dataset) and is provided via inputPath in the component specification.
How is the income-classifier pipeline defined, compiled, and run in the UI?You load component.yaml files with kfp.components.load_component_from_file, define a @dsl.pipeline function with runtime parameters, connect tasks, and compile to a YAML with the KFP compiler. In the KFP UI, upload the compiled YAML, create an Experiment, start a Run with parameter values (e.g., MinIO, Feast, MLflow settings), and monitor execution.
What design principles make components reusable and maintainable?Follow single-responsibility modularity, clearly define inputs/outputs and artifact types, parameterize environment-specific values (e.g., hosts, buckets, model names), and document behavior and usage. Benefits include reusability across pipelines, easier collaboration, and simpler testing/debugging of isolated steps.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Machine Learning Platform Engineering ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Machine Learning Platform Engineering ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Machine Learning Platform Engineering ebook for free