Skip to content

Instantly share code, notes, and snippets.

@John-Lin
Last active November 10, 2022 19:31
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save John-Lin/c8083b4db75e97cf12943c545301acd8 to your computer and use it in GitHub Desktop.
Save John-Lin/c8083b4db75e97cf12943c545301acd8 to your computer and use it in GitHub Desktop.
Kubeflow on Minikube

Deploy Kubeflow on Minikube

Install minikube

Please see How to Minikube

Running a minikube with 4CPUs and 8GB memory

$ minikube start --cpus 4 --memory 8192

If you want to use the vm driver with hyperkit

$ minikube start --vm-driver=hyperkit --cpus 4 --memory 8192

Deploy Kubeflow

$ git clone git@github.com:google/kubeflow.git
$ cd kubeflow
$ kubectl apply -f components/ -R
# Wait until all pod are getting running state. (6-7 mins)

Get the URL for the notebook.

$ minikube service tf-hub-lb --url

or access JupyterHub on http://localhost:8000 by

$ kubectl port-forward tf-hub-0 8000:8000

User Login

input any username and password will login

Basic notebook with scipy in JupyterHub

Spawner options

Image : jupyter/scipy-notebook (jupyterhub version MUST be at least 0.8.1)

CPU: 200m (could be more)

Memory: 256Mi (could be more)

Extra Resource Limits: (leave it empty)

than press the Spawn button

##Tensorflow wit notebook in JupyterHub

Spawner options

Image : gcr.io/kubeflow/tensorflow-notebook-cpu

CPU: 300m (almost run out of quota in 4 CPU minikube)

Memory: 1.5Gi (could be more)

Extra Resource Limits: (leave it empty)

than press the Spawn button

Running a tensorflow example

See Neural Network Example

You may get this message, python3.5 still works. but we are in 3.6 wait until google fixed this issue. We could just ignore.

/home/raju/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6

See tensorflow/tensorflow#14182

CPU/Mem resource monitoring on K8S

$ kubectl describe node 
@phgSW61HS
Copy link

Hi,
I have executed your commands but I ended with lots of errors when I applied the compoments. Here is a partial print of the errors:

[error validating "components/access-management/api/swagger.yaml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/access-management/cloudbuild.yaml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/access-management/example/binding.json": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/access-management/example/profile.json": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/admission-webhook/manifests/base/deployment.yaml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec; if you choose to ignore these errors, turn validation off with --validate=false, unable to recognize "components/admission-webhook/manifests/base/kustomization.yaml": no matches for kind "Kustomization" in version "kustomize.config.k8s.io/v1beta1", error validating "components/admission-webhook/manifests/base/mutating-webhook-configuration.yaml": error validating data: ValidationError(MutatingWebhookConfiguration.webhooks[0].clientConfig.service): missing required field "namespace" in io.k8s.api.admissionregistration.v1beta1.ServiceReference; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/admission-webhook/manifests/base/params.yaml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, unable to recognize "components/admission-webhook/manifests/overlays/cert-manager/certificate.yaml": no matches for kind "Certificate" in version "cert-manager.io/v1alpha2", unable to recognize "components/admission-webhook/manifests/overlays/cert-manager/certificate.yaml": no matches for kind "Issuer" in version "cert-manager.io/v1alpha2", error validating "components/admission-webhook/manifests/overlays/cert-manager/deployment.yaml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/admission-webhook/manifests/overlays/cert-manager/kustomization.yaml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/admission-webhook/manifests/overlays/cert-manager/params.yaml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/centraldashboard/.eslintrc.json": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/centraldashboard/app/.jasmine.json": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false, error validating "components/centraldashboard/cloudbuild.yaml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors

I also saw some errors like:
Error from server (Invalid): error when creating "components/admission-webhook/manifests/base/cluster-role-binding.yaml": ClusterRoleBinding.rbac.authorization.k8s.io "cluster-role-binding" is invalid: subjects[0].namespace: Required value Error from server (NotFound): error when creating "components/centraldashboard/config/centraldashboard-config.yaml": namespaces "kubeflow" not found Error from server (Invalid): error when creating "components/crud-web-apps/jupyter/manifests/base/cluster-role-binding.yaml": ClusterRoleBinding.rbac.authorization.k8s.io "cluster-role-binding" is invalid: subjects[0].namespace: Required value Error from server (NotFound): error when creating "components/crud-web-apps/tensorboards/deploy/app-rbac.yaml": namespaces "kubeflow" not found Error from server (NotFound): error when creating "components/crud-web-apps/tensorboards/deploy/app.yaml": namespaces "kubeflow" not found Error from server (NotFound): error when creating "components/crud-web-apps/tensorboards/deploy/app.yaml": namespaces "kubeflow" not found Error from server (Invalid): error when creating "components/crud-web-apps/tensorboards/manifests/base/cluster-role-binding.yaml": ClusterRoleBinding.rbac.authorization.k8s.io "cluster-role-binding" is invalid: subjects[0].namespace: Required value Error from server (Invalid): error when creating "components/crud-web-apps/volumes/manifests/base/cluster-role-binding.yaml": ClusterRoleBinding.rbac.authorization.k8s.io "cluster-role-binding" is invalid: subjects[0].namespace: Required value Error from server (Invalid): error when creating "components/notebook-controller/config/rbac/auth_proxy_role_binding.yaml": ClusterRoleBinding.rbac.authorization.k8s.io "proxy-rolebinding" is invalid: subjects[0].namespace: Required value Error from server (Invalid): error when creating "components/notebook-controller/config/rbac/role_binding.yaml": ClusterRoleBinding.rbac.authorization.k8s.io "role-binding" is invalid: subjects[0].namespace: Required value Error from server (Invalid): error when creating "components/profile-controller/config/rbac/auth_proxy_role_binding.yaml": ClusterRoleBinding.rbac.authorization.k8s.io "proxy-rolebinding" is invalid: subjects[0].namespace: Required value Error from server (Invalid): error when creating "components/profile-controller/config/rbac/role_binding.yaml": ClusterRoleBinding.rbac.authorization.k8s.io "cluster-role-binding" is invalid: subjects[0].namespace: Required value

For some of these erros (the last ones printed) I can create namespace kubeflow as well as adding some of the resources the namespace specification, but I was wondering wether you could help me set up kubeflow on minikube (I set up minikube using hyperkit drive on my mac with catalina)

@leeadh
Copy link

leeadh commented Nov 7, 2021

same here I also have these errors

@nanoschm
Copy link

Could you solve this issue?

@sfl0r3nz05
Copy link

sfl0r3nz05 commented Nov 10, 2022

I am having the same issue that @leeadh. Is it known if it has been fixed?

Note: I am not able to clone the repo from git@github.com:google/kubeflow.git, so I have used https://github.com/kubeflow/kubeflow.git.

@phgSW61HS
Copy link

phgSW61HS commented Nov 10, 2022

I am having the same issue that @leeadh. Is it known if it has been fixed?

Note: I am not able to clone the repo from git@github.com:google/kubeflow.git, so I have used https://github.com/kubeflow/kubeflow.git.

Hi guys. FYI I remember that I switched to a different approach which turned successful based on MicroK8s and multipass prior to installing KubeFlow. Here are a few links I used: https://itnext.io/microk8s-on-macos-98f1de3aa63e , https://microk8s.io/docs/install-multipass https://www.youtube.com/watch?v=KPEGKKNB63Q

Once you have installed ubuntu server VM's, it's pretty easy and the youtube video I added above is crystal clear. Just a small remark : running KF is very heavy in terms of resources (deployed around 40 pods just to run KF) As far as I remember when I deployed it locally on my macbook pro (4core 16Gb Ram) my laptop was freezing so much that the only thing I managed to do was browsing the KF web UI and printing the k8s objects in my terminal :D If you want to achieve advanced stuff with KF like ML pipelines... I would advise you to go to the cloud and provision either VMs (and of course manually install k8s through kubeadm or even microk8s) or AKS/GKE (unless you have machines at home you can use to build your own cluster... if so drop me a mail as I have already done it and I can share some docs tips and tricks)

@phgSW61HS
Copy link

phgSW61HS commented Nov 10, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment