【tutorial】How to deploy kubeflow on local machine by minikube

The Kubeflow is dedicated to making deployments of machine learning (ML) workflows on Kubernetes simple, and you can easily deploy kubeflow on your local ubuntu machine by minikube.

Check compatibility

  • kuberneters = 1.16
  • kubeflow = 1.0.1

kubeflow_compatibility

Install kfctl

Install Kubectl

  • Install lastest kubectl version

    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
    
  • Edit Permission and move to /usr/local/bin folder

    chmod +x kubectl && sudo mv kubectl /usr/local/bin/
    
  • Check kubectl version

    kubectl version
    

Install minikube

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube config set driver docker

Modify minikube permission(optional)

  • For MicroK8s to work without having to use sudo , if you don’t setting this, please add sudo at following command.

    sudo addgroup minikube
    sudo usermod -a -G minikube $USER
    newgrp minikube
    sudo chown -f -R $USER ~/.minikube
    sudo chown -f -R $USER ~/.kube
    

Start minikube

Enable GPU in Minikube(optional)

  • Install the nvidia driver, nvidia-docker and configure docker with nvidia as the default runtime: https://github.com/NVIDIA/nvidia-docker

  • Install NVIDIA’s device plugin:

    kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/master/nvidia-device-plugin.yml
    
  • Edit default runtime in docker

    • add "default-runtime": "nvidia"to /etc/docker/daemon.json

      {
          "default-runtime": "nvidia",
          "runtimes": {
              "nvidia": {
                  "path": "nvidia-container-runtime",
                  "runtimeArgs": []
              }
          }
      }
      

      and restart docker by systemctl restart docker

Deploy kubeflow

kfctl apply -V -f https://raw.githubusercontent.com/kubeflow/manifests/v1.0-branch/kfdef/kfctl_k8s_istio.v1.0.1.yaml

Install socat

  • If you are running minikube with –vm-driver=none, you need socat for port-forwarding

    sudo apt install socat
    OR
    yum install -y socat
    

Access Kubeflow Dashboard

kubectl port-forward -n istio-system service/istio-ingressgateway 8080:80 --address=0.0.0.0

Now, you can enter website 0.0.0.0:8080 to start kubeflow.

Problem fix

  • Removing the local files from /tmp/juju-store-lock* and trying again should fix this.

    sudo rm -r /tmp/juju*
    
  • Port is in used

    sudo lsof -i -P -n | grep PORT
    kill PID
    

Reference

  1. Deploy kubeflow by Kind on local ubuntu machine
  2. https://www.songbingjia.com/nginx/show-287107.html
  3. https://minikube.sigs.k8s.io/docs/tutorials/nvidia_gpu/
  4. https://anencore94.github.io/2020/08/19/minikube-gpu.html
  5. https://zhuanlan.zhihu.com/p/382294887
下面的按鈕可以直接分享🐹

歡迎留言分享你/妳的看法唷😀