sungsoo / sungsoo.github.io

Sung-Soo Kim's Blog
30 stars 8 forks source link

feat: Kubeflow installation for minikube on MacOS #10

Open sungsoo opened 2 years ago

sungsoo commented 2 years ago

feat: Kubeflow installation for minikube on MacOS

Prerequisites


Virtualization Software

Assumption

You already have virtualization software such as virtual box, docker, vmware, and so on.

NOTE

kubectl apply commands may fail on the first try. This is inherent in how Kubernetes and kubectl work (e.g., CR must be created after CRD becomes ready). The solution is to simply re-run the command until it succeeds. For the single-line command, we have included a bash one-liner to retry the command.


Install with a single command

You can install all Kubeflow official components (residing under apps) and all common services (residing under common) using the following command:

while ! kustomize build example | kubectl apply -f -; do echo "Retrying to apply resources"; sleep 10; done

Once, everything is installed successfully, you can access the Kubeflow Central Dashboard by logging in to your cluster.

Congratulations! You can now start experimenting and running your end-to-end ML workflows with Kubeflow.

Sungsoo's experience for Kubeflow installation

Prerequisites

  1. Assumption: We have virtualization software such as docker, virtualbox, vmware etc.

Minikube installation

brew install minikube

kustomize (v3.2.0) installation

wget https://github.com/kubernetes-sigs/kustomize/releases/download/v3.2.0/kustomize_3.2.0_darwin_amd64
chmod +x kustomize_3.2.0_darwin_amd64
mv kustomize_3.2.0_darwin_amd64 /usr/local/bin/kustomize
export PATH=/some/path:$PATH

Minikube starting

minikube start --kubernetes-version=v1.20.0

or

(base) ╭─sungsoo@lavender ~
╰─$ minikube start --kubernetes-version=v1.20.0 --driver=parallels

Kubeflow installation

  1. Download kubeflow manifests

    git clone https://github.com/kubeflow/manifests.git
    cd manifests
  2. kubeflow pod building

    while ! kustomize build example | kubectl apply -f -; do echo "Retrying to apply resources"; sleep 10; done
  3. kubeflow pod checking

    kubectl get pods -A -w
(traindb) ╭─sungsoo@mint ~
╰─$ kubectl get pods -A
NAMESPACE          NAME                                                         READY   STATUS             RESTARTS   AGE
auth               dex-5ddf47d88d-gszxj                                         1/1     Running            1          47m
cert-manager       cert-manager-7b8c77d4bd-74h44                                1/1     Running            0          47m
cert-manager       cert-manager-cainjector-7c744f57b5-xt8nf                     1/1     Running            0          47m
cert-manager       cert-manager-webhook-c996d766-98zff                          1/1     Running            0          47m
istio-system       authservice-0                                                1/1     Running            0          47m
istio-system       cluster-local-gateway-7796d7bc87-9jtqq                       1/1     Running            0          47m
istio-system       istio-ingressgateway-64b7899489-g765c                        1/1     Running            0          47m
istio-system       istiod-5d9bbb9cb4-469sw                                      1/1     Running            0          47m
knative-eventing   eventing-controller-64d97555b-bzdhh                          1/1     Running            0          47m
knative-eventing   eventing-webhook-5c5b8d5c6d-49gvc                            1/1     Running            0          47m
knative-eventing   imc-controller-688df5bdb4-lccg4                              1/1     Running            0          47m
knative-eventing   imc-dispatcher-5dbb47f555-crfdt                              1/1     Running            0          47m
knative-eventing   mt-broker-controller-856784c8ff-c2xfl                        1/1     Running            0          47m
knative-eventing   mt-broker-filter-68fcfcc6c8-w9pgq                            1/1     Running            0          47m
knative-eventing   mt-broker-ingress-bd54bc995-s4wxx                            1/1     Running            0          47m
knative-serving    activator-546897c9dd-wwpq9                                   1/1     Running            0          47m
knative-serving    autoscaler-7ffbf6d595-hdnj7                                  1/1     Running            0          47m
knative-serving    controller-5894998d7b-fn42b                                  1/1     Running            0          47m
knative-serving    istio-webhook-578b6b7654-tqfw5                               1/1     Running            0          47m
knative-serving    networking-istio-6b88f745c-9bzqz                             1/1     Running            0          47m
knative-serving    webhook-c59cc5b48-4q5qq                                      1/1     Running            0          47m
kserve             kserve-controller-manager-0                                  2/2     Running            0          47m
kube-system        coredns-74ff55c5b-rcg65                                      1/1     Running            0          48m
kube-system        etcd-minikube                                                1/1     Running            0          48m
kube-system        kube-apiserver-minikube                                      1/1     Running            0          48m
kube-system        kube-controller-manager-minikube                             1/1     Running            0          48m
kube-system        kube-proxy-m4ncw                                             1/1     Running            0          48m
kube-system        kube-scheduler-minikube                                      1/1     Running            0          48m
kube-system        storage-provisioner                                          1/1     Running            1          48m
kubeflow           admission-webhook-deployment-7df7558c67-rfxgq                1/1     Running            0          47m
kubeflow           cache-deployer-deployment-6f4bcc969-2z27q                    1/1     Running            0          47m
kubeflow           cache-server-7cc6cbbf55-6j794                                1/1     Running            0          47m
kubeflow           centraldashboard-5dd4f57bbd-g27sd                            1/1     Running            0          47m
kubeflow           jupyter-web-app-deployment-8d96db4cd-k9klk                   1/1     Running            0          47m
kubeflow           katib-controller-58ddb4b856-rns5n                            1/1     Running            0          47m
kubeflow           katib-db-manager-6df878f5b8-zdnhm                            1/1     Running            2          47m
kubeflow           katib-mysql-6dcb447c6f-8b9gv                                 1/1     Running            0          47m
kubeflow           katib-ui-f787b9d88-pp7r2                                     1/1     Running            0          47m
kubeflow           kfserving-controller-manager-0                               2/2     Running            0          47m
kubeflow           kfserving-models-web-app-5d6cd6b5dd-7pbnl                    1/1     Running            0          47m
kubeflow           kserve-models-web-app-6f45769bb6-x5hqd                       1/1     Running            0          47m
kubeflow           kubeflow-pipelines-profile-controller-df66bc7f4-kc5dj        1/1     Running            0          47m
kubeflow           metacontroller-0                                             1/1     Running            0          47m
kubeflow           metadata-envoy-deployment-7b847ff6c5-zrcmz                   1/1     Running            0          41m

.....

This takes more than 30 minutes.

Port-Forward

The default way of accessing Kubeflow is via port-forward. This enables you to get started quickly without imposing any requirements on your environment. Run the following to port-forward Istio's Ingress-Gateway to local port 8080:

kubectl port-forward svc/istio-ingressgateway -n istio-system 8080:80

After running the command, you can access the Kubeflow Central Dashboard by doing the following:

  1. Open your browser and visit http://localhost:8080. You should get the Dex login screen.
  2. Login with the default user's credential. The default email address is user@example.com and the default password is 12341234.
(base) ╭─sungsoo@lavender ~
╰─$ minikube service list                                                                                                                                        85 ↵
|----------------------|-----------------------------------------------------------|-------------------|---------------------------|
|      NAMESPACE       |                           NAME                            |    TARGET PORT    |            URL            |
|----------------------|-----------------------------------------------------------|-------------------|---------------------------|
| auth                 | dex                                                       | dex/5556          | http://192.168.64.6:32000 |
| cert-manager         | cert-manager                                              | No node port      |
| cert-manager         | cert-manager-webhook                                      | No node port      |
| default              | kubernetes                                                | No node port      |
| istio-system         | authservice                                               | No node port      |
| istio-system         | cluster-local-gateway                                     | No node port      |
| istio-system         | istio-ingressgateway                                      | status-port/15021 | http://192.168.64.6:32095 |
|                      |                                                           | http2/80          | http://192.168.64.6:31973 |
|                      |                                                           | https/443         | http://192.168.64.6:30783 |
|                      |                                                           | tcp/31400         | http://192.168.64.6:31079 |
|                      |                                                           | tls/15443         | http://192.168.64.6:31730 |
| istio-system         | istiod                                                    | No node port      |
| istio-system         | knative-local-gateway                                     | No node port      |
| knative-eventing     | broker-filter                                             | No node port      |
| knative-eventing     | broker-ingress                                            | No node port      |
| knative-eventing     | eventing-webhook                                          | No node port      |
| knative-eventing     | imc-dispatcher                                            | No node port      |
| knative-serving      | activator-service                                         | No node port      |
| knative-serving      | autoscaler                                                | No node port      |
| knative-serving      | controller                                                | No node port      |
| knative-serving      | istio-webhook                                             | No node port      |
| knative-serving      | webhook                                                   | No node port      |
| kserve               | kserve-controller-manager-metrics-service                 | No node port      |
| kserve               | kserve-controller-manager-service                         | No node port      |
| kserve               | kserve-webhook-server-service                             | No node port      |
| kube-system          | kube-dns                                                  | No node port      |
| kubeflow             | admission-webhook-service                                 | No node port      |
| kubeflow             | cache-server                                              | No node port      |
| kubeflow             | centraldashboard                                          | No node port      |
| kubeflow             | jupyter-web-app-service                                   | No node port      |
| kubeflow             | katib-controller                                          | No node port      |
| kubeflow             | katib-db-manager                                          | No node port      |
| kubeflow             | katib-mysql                                               | No node port      |
| kubeflow             | katib-ui                                                  | No node port      |
| kubeflow             | kfserving-controller-manager-metrics-service              | No node port      |
| kubeflow             | kfserving-controller-manager-service                      | No node port      |
| kubeflow             | kfserving-models-web-app                                  | No node port      |
| kubeflow             | kfserving-webhook-server-service                          | No node port      |
| kubeflow             | kserve-models-web-app                                     | No node port      |
| kubeflow             | kubeflow-pipelines-profile-controller                     | No node port      |
| kubeflow             | metadata-envoy-service                                    | No node port      |
| kubeflow             | metadata-grpc-service                                     | No node port      |
| kubeflow             | minio-service                                             | No node port      |
| kubeflow             | ml-pipeline                                               | No node port      |
| kubeflow             | ml-pipeline-ui                                            | No node port      |
| kubeflow             | ml-pipeline-visualizationserver                           | No node port      |
| kubeflow             | mysql                                                     | No node port      |
| kubeflow             | notebook-controller-service                               | No node port      |
| kubeflow             | profiles-kfam                                             | No node port      |
| kubeflow             | tensorboard-controller-controller-manager-metrics-service | No node port      |
| kubeflow             | tensorboards-web-app-service                              | No node port      |
| kubeflow             | training-operator                                         | No node port      |
| kubeflow             | volumes-web-app-service                                   | No node port      |
| kubeflow             | workflow-controller-metrics                               | No node port      |
| kubernetes-dashboard | dashboard-metrics-scraper                                 | No node port      |
| kubernetes-dashboard | kubernetes-dashboard                                      | No node port      |
|----------------------|-----------------------------------------------------------|-------------------|---------------------------|

References

  1. Kubeflow manifests
  2. minikube
  3. auth issue