Skip to content

Instantly share code, notes, and snippets.

@diegolovison
Last active April 16, 2024 17:39
Show Gist options
  • Save diegolovison/042db0e37b530a8638d2015f9b8ed1a6 to your computer and use it in GitHub Desktop.
Save diegolovison/042db0e37b530a8638d2015f9b8ed1a6 to your computer and use it in GitHub Desktop.
Kubeflow with kind

Prerequisite

sudo sysctl fs.inotify.max_user_instances=2280
sudo sysctl fs.inotify.max_user_watches=1255360
docker login
cat ~/.docker/config.json

Create cluster

Create a Kind cluster with Service Account Signing key for API Server for Kubeflow to work (Istio Needs it) like below

cat <<EOF | kind create cluster --name=kubeflow  --kubeconfig /home/dlovison/kindclusters/mycluster.yaml --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  image: kindest/node:v1.28.0
  extraMounts:
  - containerPath: /var/lib/kubelet/config.json
    hostPath: /home/dlovison/.docker/config.json
  kubeadmConfigPatches:
  - |
    kind: ClusterConfiguration
    apiServer:
      extraArgs:
        "service-account-issuer": "kubernetes.default.svc"
        "service-account-signing-key-file": "/etc/kubernetes/pki/sa.key"

EOF

Save the config spec somewhere

kind get kubeconfig --name kubeflow > ~/.kube/config

Kubernetes Dashboard

helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard
kubectl apply -n kubernetes-dashboard -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
EOF
kubectl apply -n kubernetes-dashboard -f - <<EOF
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
EOF
kubectl -n kubernetes-dashboard create token admin-user
kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443

Open: https://localhost:8443

Install Kubeflow

Clone the Kubeflow Manifests Repo and InstalL kubeflow by the advanced/manifests method

git clone https://github.com/kubeflow/manifests
cd manifests

Use the Install all together as one

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

Double-check the installation

kubectl get pods -n cert-manager
kubectl get pods -n istio-system
kubectl get pods -n auth
kubectl get pods -n knative-eventing
kubectl get pods -n knative-serving
kubectl get pods -n kubeflow
kubectl get pods -n kubeflow-user-example-com

Port forwarding

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

Open your browser and visit http://localhost:8080. You should get the Dex login screen. Login with the default user's credential. The default email address is user@example.com and the default password is 12341234

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