Configuring MLflow in OpenShift AI (Developer Preview)
Updated
Install MLflow by using the platform operator
- Enable the MLflow Operator component:
oc patch datasciencecluster default-dsc \
--type=merge \
-p '{"spec":{"components":{"mlflowoperator":{"managementState":"Managed"}}}}'
- Create an MLflow custom resource named
mlflow(example using SQLite and a PVC for artifact storage):
cat <<'EOF' | oc apply -f -
apiVersion: mlflow.opendatahub.io/v1
kind: MLflow
metadata:
name: mlflow
spec:
storage:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
backendStoreUri: "sqlite:////mlflow/mlflow.db"
artifactsDestination: "file:///mlflow/artifacts"
serveArtifacts: true
EOF
After installation, you can access the MLflow UI from the OpenShift web console by using the MLflow console link.
To view all available configuration options for the MLflow custom resource, run:
oc explain mlflow.spec
Install and configure the MLflow SDK
- Install the MLflow SDK from the Red Hat fork:
pip install "git+https://github.com/red-hat-data-services/mlflow@rhoai-3.2"
- Set authentication, the MLflow endpoint, and the workspace (namespace/project):
export MLFLOW_TRACKING_TOKEN="$(oc whoami --show-token)"
export MLFLOW_TRACKING_URI="https://<dashboard URL>/mlflow"
export MLFLOW_WORKSPACE="<your-namespace>"
You can also set the workspace in Python:
import mlflow
mlflow.set_workspace("<your-namespace>")
Kubernetes RBAC requirements
Your user must have permission in the target namespace/project for MLflow resources in the mlflow.kubeflow.org API group (including experiments, registeredmodels, and jobs).
The built-in edit (or admin) role in the namespace/project typically provides the required access.
Product(s)
Article Type