A Minikube-based MLflow stack.
Access the repo:
git clone https://github.com/almarch/mini-mlflow.git
cd mini-mlflowThe following toolbox is needed:
brew install minikube kubectl k9s helm
sudo apt-get update && sudo apt-get install -y docker.ioThe k8s instance may then be turned on and off:
minikube start -p my-mlflow \
--driver=docker \
--memory=6144 \
--cpus=4 \
--disk-size=50g \
--mount \
--mount-string="$(pwd)/notebook:/mnt/data/notebook"
minikube stop -p my-mlflow
minikube start -p my-mlflowGenerate all secrets:
echo "POSTGRES_MLFLOW_PASSWORD=$(openssl rand -base64 24 | tr -dc 'A-Za-z0-9' | head -c 16)" > .env
echo "MINIO_ROOT_PASSWORD=$(openssl rand -base64 24 | tr -dc 'A-Za-z0-9' | head -c 16)" >> .env
echo "MINIO_MLFLOW_PASSWORD=$(openssl rand -base64 24 | tr -dc 'A-Za-z0-9' | head -c 16)" >> .envAnd forward them to k8s:
kubectl create secret generic mlflow-secrets \
--from-env-file=.env \
--dry-run=client -o yaml > k8s/secrets.yaml
kubectl apply -f k8s/secrets.yamlIngress needs to be activated:
minikube addons enable ingress -p my-mlflowMLflow is light enough and can be built locally then pushed to the cluster:
docker build -t mlflow:latest -f Dockerfile.mlflow .
minikube image load mlflow:latest -p my-mlflowThe notebook is too heavy and must be built from within the cluster:
eval $(minikube -p my-mlflow docker-env)
docker build -t notebook:latest -f Dockerfile.notebook .
eval $(minikube docker-env -u)Load and deploy all services:
kubectl apply -f k8s/minio
kubectl apply -f k8s/postgres
kubectl apply -f k8s/mlflow
kubectl apply -f k8s/notebookThe host must allow access to the dedicated services:
IP=$(minikube ip -p my-mlflow)
echo $IP
sudo sh -c "echo \"$IP mlflow.local notebook.local\" >> /etc/hosts"
tail -n 2 /etc/hostsIf using the WSL2, you may need to install & use a browser from the WSL so that it properly uses /etc/hosts declaration:
firefox http://notebook.local/The cluster may then be monitored using k9s:
k9s