Skip to content

MiniKF Guide

JessicaBarh edited this page Jan 13, 2021 · 2 revisions

MiniKF Guide

Create local MiniKF cluster

  1. Install Vagrant and Virtual Box.
  2. Create a new directory and run vagrant init arrikto/minikf and then vagrant up (takes about 20 minutes to boot).
  3. Navigate to http://10.10.10.10.
  4. Follow on-screen steps to start Kubeflow and Rok (takes about another 20 minutes).
  5. From here, you can use Kubeflow and Rok.

  1. Download your minikf-kubeconfig file from http://10.10.10.10 and save it to your home directory

  2. run export KUBECONFIG=$HOME/minikf-kubeconfig

  3. Login to azure and docker

    az acr login k8scc01covidacrdev
    #login with statcan credentials
    
    docker login k8scc01covidacrdev.azurecr.io
    #this will create a docker config.json that will be used for creating your secret
    #see link below to find the docker credentials to use

    Use the username and password here for docker login.

  4. create secret

    kubectl create secret generic regcred \  
        --from-file=.dockerconfigjson=<path/to/.docker/config.json> \  
        --type=kubernetes.io/dockerconfigjson
  5. create a Pod that uses your Secret

    wget -O my-private-reg-pod.yaml https://k8s.io/examples/pods/private-reg-pod.yaml
  6. open the yaml file and replace <your-private-image> with the path to an image in a private registry such as: k8scc01covidacrdev.azurecr.io/hello-world:1

    The imagePullSecrets field in the configuration file specifies that Kubernetes should get the credentials from a Secret named regcred. Change that name field according to what you named your secret.

  7. create Pod and see status:

    kubectl apply -f my-private-reg-pod.yaml
    kubectl get pod private-reg

    You should see status as Running (give it a few minutes if still in Pending status). You can also use kubectl describe pods/<pod-name> to get more details.

Run Jupyter API server & frontend

The API server will connect to the Kubeflow cluster from your current kubectl context.

  1. Clone jupyter-apis repository and Install Go
  2. Copy your minikf-kubeconfig file to the .kube folder in your home directory (use Ctrl+H to show hidden items).
  3. Replace "config" with "minikf-kubeconfig" at this line in main.go. Remember to change this back before committing any changes in git.
  4. Change directory to project root: cd jupyter-apis
  5. Run go run . -spawner-config samples/spawner_ui_config.yaml (or use an alternative YAML config)

The front-end is configured to proxy requests to the local API server. It requires an environment variable (KF_USER_ID) to specify the current user – this is passed to the API server as an HTTP header.

  1. Change directory to front-end folder: cd frontend
  2. Install dependencies: npm install
  3. Run the front-end KF_USER_ID=<profile_name> npm start

The front-end is now available at http://localhost:4200/jupyter/. Since it is disconnected from the centraldashboard component, you need to type your created namespace in the UI rather than selecting it from a dropdown.

TODO:

  • add steps for creating a profile/namespace
Clone this wiki locally