Quick Start

Get started with KLearn in 5 minutes

Quick Start

This guide will help you get KLearn running locally and train your first model.

Prerequisites

Before you begin, ensure you have the following installed:

  • Docker - Container runtime
  • kind - Kubernetes in Docker
  • kubectl - Kubernetes CLI
  • Helm - Kubernetes package manager

1. Create a Cluster

First, clone the KLearn repository and create a local Kubernetes cluster:

# Clone KLearn
git clone https://github.com/klearn-dev/klearn.git
cd klearn

# Create kind cluster with local registry
./scripts/create-kind-cluster.sh

This script creates a kind cluster with:

  • A local Docker registry at localhost:5001
  • Nginx Ingress controller
  • Required namespaces

2. Install KLearn

Deploy KLearn and all its dependencies:

# Build and push images
make build push

# Deploy with Helm
make deploy

# Wait for pods to be ready
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=klearn -n klearn --timeout=300s

3. Access the Dashboard

Forward the frontend service to your local machine:

# Port forward the frontend
kubectl port-forward svc/klearn-frontend -n klearn 3000:3000 &

# Port forward the backend
kubectl port-forward svc/klearn-backend -n klearn 8000:8000 &

Open http://localhost:3000 in your browser.

4. Train Your First Model

Option A: Using the Dashboard

  1. Navigate to DatasetsUpload
  2. Upload a CSV file (e.g., iris.csv)
  3. Go to ExperimentsNew
  4. Select your dataset, target column, and task type
  5. Click Start Training

Option B: Using kubectl

Apply a KLearnJob manifest:

apiVersion: klearn.klearn.dev/v1alpha1
kind: KLearnJob
metadata:
  name: iris-classification
  namespace: klearn
spec:
  dataSource:
    type: minio
    uri: s3://klearn/datasets/iris.csv
  taskType: classification
  targetColumn: species
  flamlConfig:
    timeBudget: 120
    metric: accuracy
kubectl apply -f samples/klearnjob-sample.yaml

Monitor the job:

kubectl get klearnjob -n klearn -w

5. Deploy Your Model

Once training completes, deploy the model:

# Check available models
kubectl get klearnmodel -n klearn

# Deploy using the API
curl -X POST http://localhost:8000/api/v1/models/iris-classification-model/deploy \
  -H "Content-Type: application/json" \
  -d '{"deployment_type": "klearn", "replicas": 2}'

That's it! 🎉 Your model is now serving predictions.

Next Steps