How to customise your Kubeflow deployment

This document describes ways how you can customize the Kubeflow deployment by either enhancing it with other charms or editing existing ones.

Contents:

Extend Bundle with other charms

The purpose behind Kubeflow has been to gather together useful tools for AI/ML into a cohesive collection which makes it easier for users to focus on the work they actually want to do rather than configuring and deploying applications.

But not everybody’s needs are the same, and one of the benefits of deploying Charmed Kubeflow is that it is straightforward to mix and match the components of Kubeflow you actually need.

This approach starts with the different Kubeflow bundles at install time, but there is no need to stick with what you initially installed

Once you have familiarised yourself with all that Kubeflow can offer, you can quickly add any application inside Kubeflow to your current bundle.

You could, for example, start with the Kubeflow lite bundle and add Katib, the hyperparameter tuning piece of Kubeflow, later on. To do this you just need to run these commands:

juju deploy katib-controller
juju deploy katib-db-manager
juju deploy katib-db
juju deploy katib-ui

You should also integrate applications that have been deployed with these commands:

juju relate katib-db-manager katib-db
juju relate istio-pilot katib-ui

Even the full bundle can be extended with any of the many Kubeflow applications.

Exposing the Kubeflow with Ingress

Sometimes you may want to expose your Kubeflow deployment outside throu HTTP and HTTPS. You can achieve this by creating Ingress resource in you cluster. Here is how you can achieve this:

Setup Ingress controller

First you need to make sure that the Ingress controller is presented in the cluster. For the microk8s you can enable it with an addon (which installs nginx-ingress-controller).
microk8s enable ingress

In case of other Kubernetes deployments you can install the same controller (e.g. with helm instructions) . If you are running Kubernetes as a service on the public cloud provider, you should always check for recommended ingress controllers (e.g. for AWS)

Adjusting the bundle file (only for versions 1.6 and sooner)

For versions 1.6 and sooner the support for the ingress exposure is available for edge version of istio-charm which is part of kubernetes bundle. To have this functionality enabled you need to edit the bundle file. First you should clone the repo with bundle:
git clone git@github.com:canonical/bundle-kubeflow.git

Go to desired relase folder

cd  ./releases/<version>/<edge-stable-beta>/<kubeflow-kubeflow-lite>

Note: kubeflow-lite is a strip version of kubeflow which is ideal for experimentation.

Now you should edit the the bundle.yaml file with following section:

  istio-ingressgateway:
    series: kubernetes
    charm: istio-gateway
    channel: latest/edge
    scale: 1
    trust: true
    _github_repo_name: istio-operators
    options:
      kind: ingress
      gateway_service_type: ClusterIP
  istio-pilot:
    series: kubernetes
    charm: istio-pilot
    channel: latest/edge
    scale: 1
    trust: true
    _github_repo_name: istio-operators
    options:
      default-gateway: kubeflow-gateway

Now you can deploy the bundle (before make sure do remove kubelfow deployment as this will deploy the whole bundle again).

juju-deployer -c bundle.yaml kubeflow

Wait until components are in active state (juju status --watch 5s)

Create Ingress resource

Now you can create the ingress resource to expose your kubeflow.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kubeflow-ingress
  namespace: kubeflow
spec:
  rules:
    - http:
        paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: istio-ingressgateway-workload
              port:
                number: 80

You can create TLS ingress if you have needed certificates (follow this guide)

1 Like

Do you mean “later” here? This step does not seem to be necessary with Kubeflow 1.8, as far as I can tell

I gave this a quick read and I think some things here are out of date (originally written about 3 years ago). I suggest anyone interested in this to look at the charmed-kubeflow docs for more up to date guides like this.