Skip to content

wmeints/mlflow-chart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MLflow Server

This repository contains the Docker image and Helm chart for deploying MLflow server with PostgreSQL backend.

Repository Structure

.
├── image/          # Docker image for MLflow server
│   └── Dockerfile
└── charts/         # Helm chart for Kubernetes deployment
    └── mlflow/

Prerequisites

  • Docker
  • Kubernetes cluster with OpenShift (required for Route resource)
  • Helm 3.x
  • PostgreSQL database

Deployment Instructions

1. Build and Publish Docker Image

First, build the MLflow Docker image:

cd image
docker build -t willemm/mlflow:3.4.0 .

Then publish the image to your container registry:

docker push willemm/mlflow:3.4.0

2. Prepare Database Secret

This chart is designed to work with the Crunchy Data PostgreSQL Operator secret format. If you're using the Crunchy Data PostgreSQL Operator, the secret is automatically created for you (e.g., hippo-pguser-hippo).

The secret should contain the following keys:

  • host: Database host
  • port: Database port
  • dbname: Database name
  • user: Database user
  • password: Database password

If you need to create a manual secret with this format:

kubectl create secret generic mlflow-secret \
  --from-literal=host=<your-db-host> \
  --from-literal=port=5432 \
  --from-literal=dbname=mlflow \
  --from-literal=user=<your-db-user> \
  --from-literal=password=<your-db-password>

3. Configure Artifact Storage

MLflow supports two types of artifact storage: local persistent volumes and S3-compatible storage.

Option A: Local Storage (Default)

Create a custom values.yaml file:

image:
  repository: willemm/mlflow
  tag: "3.4.0"

database:
  secret: mlflow-secret

artifacts:
  type: local
  root: /mlflow/artifacts

persistence:
  enabled: true
  size: 20Gi
  storageClass: "your-storage-class"

Option B: S3 Storage

First, create a Kubernetes secret with S3 credentials:

kubectl create secret generic mlflow-s3-secret \
  --from-literal=access-key-id=<your-access-key> \
  --from-literal=secret-access-key=<your-secret-key>

Then create a custom values.yaml file:

image:
  repository: willemm/mlflow
  tag: "3.4.0"

database:
  secret: mlflow-secret

artifacts:
  type: s3
  s3:
    bucket: my-mlflow-bucket
    path: artifacts
    endpoint: "" # Optional: for S3-compatible storage (e.g., MinIO)
    secret: mlflow-s3-secret

persistence:
  enabled: false # Not needed for S3 storage

4. Deploy Helm Chart

Deploy the chart to your Kubernetes environment:

helm install mlflow ./charts/mlflow -f values.yaml

Important Notes

  • OpenShift Required: This Helm chart uses OpenShift Route resources for ingress. If you're not using OpenShift, you'll need to modify the chart to use standard Kubernetes Ingress resources.
  • Crunchy Data PostgreSQL Operator: The chart expects a pre-existing database secret in the Crunchy Data PostgreSQL Operator format (with keys: host, port, dbname, user, password). If using the operator, reference the auto-generated secret (e.g., hippo-pguser-hippo).
  • Artifact Storage: Choose between local persistent volumes or S3-compatible storage. For S3 storage, you'll need to create a separate secret with AWS credentials.
  • The default TLS termination is set to edge in the OpenShift Route.

Configuration

Key configuration options in values.yaml:

  • image.repository: Docker image repository
  • image.tag: Docker image tag
  • database.secret: Name of the Kubernetes secret containing database credentials
  • artifacts.type: Artifact storage type (local or s3)
  • artifacts.root: Local artifact storage path (when using local storage)
  • artifacts.s3.bucket: S3 bucket name (when using S3 storage)
  • artifacts.s3.path: Path within S3 bucket for artifacts
  • artifacts.s3.endpoint: Custom S3 endpoint URL (optional, for S3-compatible storage like MinIO)
  • artifacts.s3.secret: Name of Kubernetes secret containing S3 credentials
  • persistence.enabled: Enable persistent storage for artifacts (only needed for local storage)
  • persistence.size: Size of the persistent volume
  • resources: CPU and memory limits/requests

For all available configuration options, see charts/mlflow/values.yaml.

About

A Helm chart for deploying MLFlow on Kubernetes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •