Interactive guide to experiment tracking with MLflow.
- Create an Azure Container Registry if you don't have one yet:
az acr create --resource-group <YOUR_RESOURCE_GROUP> --name <YOUR_ACR_REGISTRY_NAME> --sku Basic --admin-enabled true
- Fill in the
.env
file in this project:RESOURCE_GROUP
: The name of your resource group (<YOUR_RESOURCE_GROUP>
from step 1)ACR_NAME
: The name of your Azure Container Registry (<YOUR_ACR_REGISTRY_NAME>
from step 1)ACR_CONTAINER_NAME
: The name of your container image (e.g.mlflow_image
)ACR_USERNAME
: The username of your ACRACR_PASSWORD
: The password of your ACRAKS_CLUSTER_NAME
: The name of your AKS cluster (free to choose)
Note: You can find your ACR credentials with:
az acr credential show --name <YOUR_ACR_REGISTRY_NAME>
- Export the environment variables from the
.env
file:
set -a
source .env
set +a
- Build the container image:
docker build --platform linux/amd64 . -t ${ACR_NAME}.azurecr.io/${ACR_CONTAINER_NAME}:latest
- Push the container image to your ACR:
az login
az acr login --name $ACR_NAME
docker push ${ACR_NAME}.azurecr.io/${ACR_CONTAINER_NAME}:latest
Note: You can check if the image is pushed to your ACR with:
az acr repository list --name $ACR_NAME --output table
- Create an AKS cluster:
az aks create --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --node-count 1 --generate-ssh-keys
- Get the credentials for your AKS cluster:
az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME
- Create a Kubernetes secret for your ACR:
kubectl create secret docker-registry acr-secret --docker-server=$ACR_NAME.azurecr.io --docker-username=$ACR_USERNAME --docker-password=$ACR_PASSWORD
- Apply the deployment file to your AKS cluster:
kubectl apply -f mlflow-deployment.yaml
- Wait for the external IP to be assigned to the service. You can check the status with:
kubectl get service mlflow-service --watch
Once the EXTERNAL-IP is assigned, you can access your MLflow instance using that IP address on port 80 (i.e., http://< EXTERNAL-IP >/).
- Cleanup
az group delete --name $RESOURCE_GROUP
Or, if you want to keep your resource group, you can delete the AKS cluster and/or the ACR registry:
az aks delete --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --yes --no-wait
az acr delete --resource-group $RESOURCE_GROUP --name $ACR_NAME --yes --no-wait