Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

Kubeflow: ML Pipelines on Kubernetes

By Kokil Thapa | Last reviewed: August 2026

Kubeflow: ML Pipelines on Kubernetes provides a standardized, container-native framework for orchestrating end-to-end machine learning workflows directly on your existing cluster infrastructure. For engineering teams already managing Laravel APIs or eCommerce backends on Kubernetes, adopting CI/CD pipeline patterns for machine learning eliminates the friction between experimental notebooks and production-grade model serving. This guide covers the practical architecture, SDK implementation, and operational realities of running Kubeflow in 2026, focusing on reproducible execution rather than theoretical MLOps concepts.

How does Kubeflow: ML Pipelines on Kubernetes actually work?

At its core, Kubeflow Pipelines (KFP) translates Python DSL definitions into Argo Workflow YAML manifests that the Kubernetes API server schedules as pod sequences. Each pipeline step runs in an isolated container with explicit input/output contracts, ensuring reproducibility regardless of the underlying node or cluster state. Unlike ad-hoc notebook executions, every run produces traceable artifacts stored in object storage (MinIO, S3, or GCS) with full lineage metadata.

Python DSLkfp.components@dsl.componentArgo WorkflowYAML ManifestDAG + StepsK8s PodsContainer ExecArtifact I/OPersistent Artifact Store (MinIO / S3 / GCS)Model Weights • Datasets • Metrics • Lineage Metadata
Kubeflow: ML Pipelines on Kubernetes compiles Python DSL into Argo Workflows executed as pods with persistent artifact storage

The KFP v2 SDK (current stable as of 2026) uses IR (Intermediate Representation) YAML instead of direct Argo coupling, enabling backend portability across Argo, Tekton, or cloud-managed implementations. When you call kfp.compiler.Compiler().compile(), the output is a self-contained workflow spec that references container images by digest, not mutable tags. This immutability guarantee is what separates production ML from experimental chaos.

In practice, teams integrating Laravel API services with ML backends use Kubeflow’s REST API to trigger pipelines from application events — for example, retraining a recommendation model when new order data arrives via webhook. The pipeline then writes updated model artifacts to shared storage that the Laravel service consumes through a model-serving sidecar or dedicated inference endpoint.

How do you write reproducible pipeline components with KFP v2?

Reproducibility starts with component isolation. Every KFP component must declare explicit inputs, outputs, and container dependencies. Avoid implicit state: no reading from global filesystem paths, no unversioned pip installs, no hardcoded credentials. Here is a production-ready component pattern using the v2 lightweight decorator:

<?php
// Not PHP — this is Python KFP v2 syntax shown for reference
from kfp import dsl
from kfp.dsl import Output, Dataset, Model

@dsl.component(
    base_image='python:3.11-slim@sha256:abc123...',  # Pin by digest
    packages_to_install=['pandas==2.2.2', 'scikit-learn==1.5.1']
)
def preprocess_data(
    raw_dataset: Input[Dataset],
    cleaned_dataset: Output[Dataset]
):
    import pandas as pd
    df = pd.read_csv(raw_dataset.path)
    df = df.dropna(subset=['price', 'category'])
    df.to_csv(cleaned_dataset.path, index=False)

Key discipline points I enforce on client projects:

  • Pin base images by SHA256 digest, not tag. Tags mutate; digests don’t.
  • Declare all packages in packages_to_install with exact versions. Never rely on transitive resolution.
  • Use typed artifacts (Dataset, Model, Metric) instead of raw strings. This enables UI visualization and lineage tracking.
  • Never import heavy libraries at module level. Import inside the function body to reduce component load time and avoid dependency leakage.

For teams accustomed to modern Laravel architecture, think of KFP components like Form Requests: they validate and transform inputs before business logic executes. The difference is enforcement happens at orchestration time, not runtime. If a downstream component expects a Model artifact but receives a Dataset, the pipeline fails before execution — catching integration errors during compilation, not after hours of GPU spend.

What infrastructure does Kubeflow require beyond vanilla Kubernetes?

Kubeflow is not a single binary; it is a collection of interdependent services. Understanding these dependencies prevents costly mid-deployment surprises. Below is a comparison of deployment options based on real operational trade-offs observed across Nepal-based and international client environments:

Deployment TargetSetup ComplexityOperational OverheadBest For2026 Notes
Full Kubeflow Platform (KFDef)HighVery HighLarge orgs needing Notebooks, Katib, KServeOften overkill; many teams only need Pipelines
Kubeflow Pipelines StandaloneMediumMediumTeams with existing K8s wanting ML orchestrationRecommended default for most production use cases
Cloud Managed (Vertex AI, SageMaker)LowLowAWS/GCP shops avoiding self-hosted opsVendor lock-in; higher per-run cost
Local (Kind/k3d + KFP)LowN/ADevelopment and testing onlyNot production-viable; use for SDK validation
KFP API ServerMySQL / PostgreSQLMinIO / S3Argo ControllerIstio / Dex (Auth)MLMD / Metadata
Core infrastructure dependencies for Kubeflow: ML Pipelines on Kubernetes including metadata, storage, and auth layers

Critical gotchas from production deployments:

  1. Object storage is non-negotiable. KFP stores pipeline specs, run artifacts, and intermediate data here. Using ephemeral pod storage guarantees data loss on reschedule.
  2. Metadata store (MLMD) requires persistent SQL. SQLite works locally but fails under concurrent access. Use MySQL 8.4 or PostgreSQL 16+ with connection pooling.
  3. Istio adds significant complexity. If you don’t need multi-user isolation or mTLS between components, deploy KFP standalone without Istio. Many Nepal-based clients opt for namespace-level RBAC instead.
  4. Resource quotas prevent runaway costs. Always set CPU/memory limits on pipeline namespaces. A misconfigured GPU request can exhaust cluster capacity in minutes.

How do you handle secrets and configuration in production pipelines?

Hardcoding credentials in component code is the most common security failure in ML pipelines. KFP supports Kubernetes-native secret management through volume mounts and environment variables. Never bake secrets into container images.

@dsl.component
def fetch_training_data(
    api_key_secret: str,
    output: Output[Dataset]
):
    import os
    import requests
    
    # Secret injected via K8s Secret volume mount
    key_path = f'/secrets/{api_key_secret}/key'
    with open(key_path) as f:
        api_key = f.read().strip()
    
    resp = requests.get(
        'https://api.example.com/data',
        headers={'Authorization': f'Bearer {api_key}'}
    )
    # ... process and save to output.path

In the pipeline definition, bind the secret explicitly:

@dsl.pipeline(name='secure-training-pipeline')
def train_pipeline():
    data_task = fetch_training_data(api_key_secret='data-api-key')
    data_task.set_env_variable(
        name='SECRET_MOUNT_PATH',
        value='/secrets/data-api-key'
    )
    # Attach Kubernetes Secret as volume
    from kubernetes import client as k8s_client
    data_task.add_pvolumes({
        '/secrets/data-api-key': k8s_client.V1Volume(
            name='data-api-secret',
            secret=k8s_client.V1SecretVolumeSource(
                secret_name='data-api-key',
                optional=False
            )
        )
    })

This pattern mirrors how secure authentication systems handle credential injection in web applications. The key principle: secrets exist only in Kubernetes Secrets objects, never in code repositories, container layers, or pipeline YAML. Rotate them independently of pipeline deployments.

How do you monitor and debug failed pipeline runs effectively?

Kubeflow’s UI shows high-level run status but lacks depth for root cause analysis. Production debugging requires layered observability:

Pipeline Run FailedCheck Pod LogsInspect ArtifactsValidate InputsOOM / Resource LimitData Schema DriftSecret Missing
Systematic debugging flow for Kubeflow: ML Pipelines on Kubernetes failures covering logs, artifacts, and inputs
  • Pod logs first. Use kubectl logs <pod-name> -n kubeflow or the KFP UI log viewer. Most failures are OOM kills, missing dependencies, or permission errors visible here.
  • Artifact inspection second. Download intermediate datasets/models from object storage. Validate schema, row counts, and null rates against expectations. Data drift causes silent correctness failures.
  • Input contract verification third. Compare actual input artifact types/sizes against component signatures. Type mismatches fail fast; shape mismatches fail late.
  • Resource profiling fourth. Enable Prometheus metrics scraping on pipeline pods. Track memory/CPU usage patterns across runs to right-size requests and avoid throttling.

On one legal-tech portal handling document classification, we reduced pipeline failure diagnosis time from hours to minutes by adding structured logging with correlation IDs passed between components. Each log line included the run ID, step name, and artifact version — making grep-based forensics viable even without centralized logging infrastructure.

When should you choose alternatives over Kubeflow?

Kubeflow is powerful but not universally optimal. Evaluate honestly against your constraints:

  • Choose Airflow/Prefect if: Your workflows are primarily ETL/data engineering with occasional ML steps. KFP’s container-per-step overhead is excessive for simple SQL transformations.
  • Choose cloud-managed ML if: Your team lacks Kubernetes operations expertise and budget allows vendor premiums. Self-hosting KFP requires ongoing maintenance investment.
  • Choose ZenML/Metaflow if: You need framework-agnostic pipelines spanning local/cloud/hybrid without Kubernetes dependency. These abstract away infra at the cost of ecosystem maturity.
  • Stick with Kubeflow if: You already operate Kubernetes, need GPU scheduling, require strict artifact lineage, or must avoid vendor lock-in. The operational cost pays off at scale.

For Nepal-based organizations evaluating cloud hosting options, consider that KFP’s resource baseline (~4GB RAM, 2 CPU cores for control plane) may exceed small VPS allocations. Start with standalone KFP on managed Kubernetes (DigitalOcean, Linode) before committing to full platform deployment.

Implementing Kubeflow: ML Pipelines on Kubernetes Responsibly

Kubeflow: ML Pipelines on Kubernetes delivers genuine value when treated as production infrastructure, not an experiment. Success requires disciplined component design, proper secret management, realistic resource planning, and honest assessment of operational capacity. Start with standalone Pipelines, pin all dependencies by digest, integrate monitoring from day one, and resist the urge to adopt the full platform until you’ve validated the core orchestration layer meets your needs. If your team manages Laravel or eCommerce systems on Kubernetes today, the patterns transfer directly — treat ML pipelines with the same rigor as any other critical workload. Ready to architect your ML infrastructure? Discuss your Kubeflow deployment requirements for a practical, production-focused assessment.

Frequently Asked Questions

Kubeflow is an open-source platform that orchestrates machine learning workflows natively on Kubernetes. It provides pipeline scheduling, experiment tracking, and notebook management as cloud-native services. For teams already running Kubernetes, it avoids managing separate Airflow or Jenkins infrastructure while keeping ML workloads portable across AWS EKS, GKE, or on-premise clusters.

Kubeflow Pipelines is purpose-built for ML with native support for containerized steps, artifact passing, and metadata tracking. Airflow is a general-purpose DAG scheduler requiring custom operators for ML tasks. In my experience integrating AI APIs into web systems, Kubeflow reduces boilerplate for model training and serving, while Airflow remains better for complex data engineering dependencies outside pure ML orchestration.

Production Kubeflow requires at least 3 worker nodes with 8GB RAM each, 4 vCPUs per node, and 100GB SSD storage. The control plane alone consumes significant resources for Istio, Argo Workflows, and metadata services. I recommend starting with managed Kubernetes like EKS or GKE rather than self-managed clusters unless your team has dedicated DevOps capacity for service mesh troubleshooting.

Yes, via REST API calls to the Kubeflow Pipelines API server. Your Laravel application can trigger pipeline runs, pass parameters, and retrieve results using HTTP clients like Guzzle. Store API tokens securely in environment variables and implement retry logic with exponential backoff. This pattern works well when legal-tech portals or eCommerce platforms need to invoke ML inference without embedding Python directly in PHP processes.

Expect USD 300–600 monthly (NPR 40,000–80,000) for a minimal production cluster on AWS or GCP, excluding GPU costs. GPU-enabled nodes add USD 500–2,000+ depending on instance type. On-premise deployments have higher upfront hardware costs but lower recurring expenses. Budget-conscious Nepal projects should evaluate whether simpler batch scripts or managed ML services suffice before committing to full Kubeflow overhead.

Use S3-compatible object storage like MinIO for on-premise or AWS S3/GCS for cloud deployments. Configure persistent volumes for notebook user directories and shared datasets. Avoid NFS for high-concurrency workloads due to locking issues. In production deployments I have seen, misconfigured storage permissions cause more pipeline failures than any other single issue, so validate read/write access during initial setup thoroughly.

Enable Kubernetes RBAC with namespace isolation per team or project. Configure Istio mTLS for service-to-service encryption and restrict pipeline execution to authorized service accounts. Integrate with OIDC providers for user authentication. Never expose the Kubeflow dashboard publicly without authentication. For legal-tech platforms handling sensitive documents, encrypt artifacts at rest and audit all pipeline executions through centralized logging.

Insufficient memory limits on pipeline step containers cause OOMKilled failures. Set explicit resource requests and limits in component YAML based on actual profiling, not guesses. Large dataset loading or model training often exceeds default 2GB limits. Monitor pod metrics with Prometheus and adjust incrementally. In my experience, this is the most common production debugging issue after initial deployment, especially when developers test locally with smaller datasets.

Kubeflow primarily handles batch training and offline inference pipelines. For real-time serving, deploy models separately using KServe, Seldon Core, or Triton Inference Server alongside Kubeflow. These serving solutions integrate with Kubeflow's model registry but operate independently for low-latency requests. Do not force synchronous inference through pipeline steps; this creates unnecessary latency and couples serving availability to pipeline scheduler health.

Tag every pipeline run with Git commit hashes, container image digests, and parameter snapshots. Use Kubeflow Metadata to track input/output artifacts automatically. Store pipeline definitions as code in Git repositories, not uploaded manually via UI. Pin base image versions explicitly rather than using latest tags. Reproducibility fails silently when any dependency drifts, so treat pipeline configuration with the same rigor as application deployment automation.

Deploy Prometheus and Grafana for cluster and pipeline metrics, Loki or Fluentd for logs, and Jaeger for distributed tracing if using Istio. Kubeflow exposes metrics endpoints natively. Alert on pipeline failure rates, pod restart counts, and storage utilization. In production environments I maintain, lacking observability makes debugging intermittent failures nearly impossible, so invest in monitoring setup before scaling beyond experimental workloads.

Managed options like AWS SageMaker Pipelines, Vertex AI Pipelines, or Azure ML reduce operational burden significantly. Self-hosted Kubeflow offers portability and cost control but demands Kubernetes expertise for upgrades, security patches, and service mesh maintenance. For Nepal-based teams without dedicated platform engineers, managed services often justify their premium through reduced debugging time. Evaluate total cost including engineer hours, not just infrastructure bills.

Containerize each script step with explicit input/output interfaces using argparse or click. Define component specs in YAML declaring parameters, artifacts, and container images. Start by wrapping monolithic scripts as single steps, then decompose into granular reusable components iteratively. Test components locally with Docker before submitting to pipelines. Resist rewriting working code purely for Kubeflow compatibility; wrap first, refactor later based on actual reuse patterns.

Major version upgrades often break backward compatibility for pipeline DSL, CRDs, and storage schemas. Always test upgrades in staging with representative pipelines first. Backup etcd and metadata databases before upgrading. Check release notes for deprecated features and migration guides. In my experience, skipping minor versions compounds breaking changes. Schedule upgrade windows during low-traffic periods and prepare rollback procedures including database restoration scripts.

Skip Kubeflow if you have fewer than five recurring ML workflows, no Kubernetes expertise, or simple cron-scheduled scripts suffice. Single-developer projects rarely justify the operational complexity. Consider Prefect, Dagster, or even GitHub Actions for lighter-weight orchestration. Kubeflow pays off at scale with multiple teams sharing infrastructure. Premature adoption creates maintenance debt that outweighs benefits until organizational complexity genuinely demands Kubernetes-native ML platforming.

Share this article

Quick Contact Options
Choose how you want to connect me: