|
| 1 | ++++ |
| 2 | +title = "MLflow Plugin Configuration" |
| 3 | +weight = 3 |
| 4 | ++++ |
| 5 | + |
| 6 | +## KFP MLflow Plugin |
| 7 | + |
| 8 | +Kubeflow Pipelines supports an MLflow plugin that enables automatic experiment tracking. When enabled, the plugin registers each KFP run with MLflow, allowing users to view and analyze their pipeline runs in the MLflow UI. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +- Admin access to a Kubernetes cluster |
| 13 | +- Kubeflow Pipelines installed on your cluster |
| 14 | +- kubectl configured to access your cluster |
| 15 | + |
| 16 | +## Deploying MLflow |
| 17 | + |
| 18 | +You need an MLflow instance running on your Kubernetes cluster. One recommended option is the [OpenDataHub MLflow Operator](https://github.com/opendatahub-io/mlflow-operator), which simplifies MLflow deployment and management on Kubernetes. |
| 19 | + |
| 20 | +To deploy using the MLflow Operator: |
| 21 | + |
| 22 | +1. Follow the [deployment instructions](https://github.com/opendatahub-io/mlflow-operator#to-deploy-on-the-cluster) in the operator repository |
| 23 | +2. Note the MLflow service endpoint and port (typically `https://<service-name>:8443`) |
| 24 | +3. If using TLS, obtain the CA certificate for your MLflow deployment |
| 25 | + |
| 26 | +## Security and TLS |
| 27 | + |
| 28 | +The KFP MLflow plugin uses TLS to secure communication with the MLflow server. Configure the following TLS settings in your API server configuration: |
| 29 | + |
| 30 | +- **caBundlePath**: Path to the CA certificate bundle used to verify the MLflow server's certificate |
| 31 | +- **insecureSkipVerify**: Set to `false` (default) to enforce certificate verification |
| 32 | + |
| 33 | +For production deployments, always use valid TLS certificates and keep `insecureSkipVerify` set to `false`. |
| 34 | + |
| 35 | +## MLflow Experiments |
| 36 | + |
| 37 | +When the plugin is enabled, pipeline runs are logged to MLflow experiments: |
| 38 | + |
| 39 | +- **Default experiment**: If no experiment is specified, runs are logged to an experiment named "default" (created automatically if it doesn't exist) |
| 40 | +- **Custom experiments**: Users can specify a custom experiment name when submitting a run. KFP will create the experiment if it doesn't already exist |
| 41 | +- **RBAC**: For enhanced security, you can enforce Kubernetes RBAC for MLflow requests using the [Kubeflow MLflow extension](https://github.com/kubeflow/mlflow-integration) |
| 42 | + |
| 43 | +## MLflow Workspaces |
| 44 | + |
| 45 | +MLflow workspaces provide an optional organizational layer and permission framework, similar to Kubernetes namespaces. A workspace can contain multiple experiments, but each experiment belongs to only one workspace. |
| 46 | + |
| 47 | +**Configuration:** |
| 48 | +- When `authType` is set to `kubernetes`, workspaces are **enabled by default** |
| 49 | +- For other authentication types, workspaces are **disabled by default** |
| 50 | +- You can explicitly control this behavior by setting `workspacesEnabled` to `true` or `false` in the plugin configuration |
| 51 | + |
| 52 | +**Requirements:** |
| 53 | +To use MLflow workspaces, you must deploy the [Kubeflow MLflow extension](https://github.com/kubeflow/mlflow-integration), which adds Kubernetes-native authentication and multi-tenancy support to MLflow. |
| 54 | + |
| 55 | +## Configuring the KFP MLflow Plugin |
| 56 | + |
| 57 | +To enable the MLflow plugin, add the following configuration to your KFP API server `config.json` file: |
| 58 | + |
| 59 | +```json |
| 60 | +{ |
| 61 | + "plugins": { |
| 62 | + "mlflow": { |
| 63 | + "endpoint": "https://<mlflow-service>:8443", |
| 64 | + "timeout": 30, |
| 65 | + "tls": { |
| 66 | + "insecureSkipVerify": <boolean>, |
| 67 | + "caBundlePath": "<path-to-ca-bundle>" |
| 68 | + }, |
| 69 | + "settings": { |
| 70 | + "workspacesEnabled": true, |
| 71 | + "authType": "kubernetes", |
| 72 | + "defaultExperimentName": "default", |
| 73 | + "experimentDescription": "Created by Kubeflow Pipelines" |
| 74 | + } |
| 75 | + } |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +### Configuration Values |
| 81 | + |
| 82 | +Replace the placeholder values with your deployment-specific values: |
| 83 | + |
| 84 | +- **endpoint**: The full URL of your MLflow server (e.g., `https://mlflow-service.mlflow.svc.cluster.local:8443`) |
| 85 | +- **timeout**: Timeout in seconds for MLflow API calls (default: `30`) |
| 86 | +- **tls**: TLS configuration for MLflow communication |
| 87 | + - **insecureSkipVerify**: Set to `true` to skip TLS certificate verification (not recommended for production) |
| 88 | + - **caBundlePath**: Path to the CA certificate for your MLflow server |
| 89 | +- **settings**: See the [user guide](/docs/components/pipelines/user-guides/integrations/mlflow-plugin/) for a complete list of MLflow plugin settings |
| 90 | + |
| 91 | +## Restart the API Server |
| 92 | + |
| 93 | +After updating the configuration, restart the KFP API server to apply the changes: |
| 94 | + |
| 95 | +```bash |
| 96 | +kubectl rollout restart deployment/ml-pipeline -n kubeflow |
| 97 | +``` |
| 98 | + |
| 99 | +Verify the plugin is enabled by checking the API server logs: |
| 100 | + |
| 101 | +```bash |
| 102 | +kubectl logs -n kubeflow deployment/ml-pipeline | grep mlflow |
| 103 | +``` |
| 104 | + |
| 105 | +You should see messages indicating the MLflow plugin has been initialized successfully. |
0 commit comments