Learning Environment Installation

Learning Environment Installation

The MDAI Learning Environment is a full instance of the MdaiHub with all its clustered components, but running using Kind / Docker on your machine of choice. There are 2 ways to install the Learning Environment.

  • A quick, cli-based install gets the MDAI sandbox up and running in minutes.

  • A step-by-step install that let’s you see each of the components composing an MDAI cluster.

Note

These instructions work for *nix environments. They mostly work on Mac OS as well. (Windows is not supported at this time.)

Prerequisites

Before you install the MDAI Leaning Environment, you’ll need a GitHub account to access resources from MyDecisive repos.

You’ll also need to install the following software.

  1. You can get a local copy of MDAI’s components by cloning the mdai-labs GitHub repo. Don’t be confused by the “labs” moniker. We use labs to mean both things that you can learn about as well as modular components that install via our sandbox CLI. So go ahead and clone the labs repo in its entirety. It is fun. You get to learn a lot. And most of what you have to get done is available as a lab.

    git clone https://github.com/DecisiveAI/mdai-labs.git
  2. Before you install the MDAI Learning Environment, make sure Docker is running.

  3. Run the installation commands from the cloned mdai-labs repo’s root directory.

Using the MDAI CLI

What is the MDAI “CLI”?

The MDAI CLI is an installation, command and control plane shell script used for managing your MDAI instances.

Please note the shell script is experimental and we plan to make this a real CLI in the near future.

If you don’t want to use our “cli” script, you can use the manual installation method instead. Be sure to switch tabs from automated to manual.

Setting up the MDAI CLI

Clone our mdai-labs repo

git clone https://github.com/DecisiveAI/mdai-labs.git

Create an mdai alias for the shell script

Recommended! You can create an alias in you .bashrc, .zshrc, or equivalent to run the command line. We will be using mdai to refer to the ./mdai/cli script in these docs.

In your .bashrc (or equivalent), add this to EOF

# Set this to the path of your local clone of mdai-labs
export MDAI_LABS_DIR="$HOME/path/to/mdai-labs"

# Set mdai alias
alias mdai="${MDAI_LABS_DIR%/}/cli/mdai.sh"

Make the MDAI script file executable.

cd path/to/mdai-labs
chmod +x ./cli/mdai.sh

You can now call mdai from your terminal and use it like you would any other CLI.

<!– mdai alias –>
mdai <command> [command flags]

<!-- alternative without alias -->
./cli/mdai.sh <command> [command flags]

Choose an Installation Method

You will need to install the CLI to run automated workflows

Install an MdaiHub

Run the following script commands to install your local MDAI Learning Environment.

Do you need a Kubernetes cluster? This will help you instantiate one.

Option 1: Install an MdaiHub with cert-manager

This command installs a local kind cluster and an MdaiHub.

mdai install --version 0.8.6 -f values/overrides_0.8.6.yaml

Add a role binding for the OpenTelemetry operator

kubectl apply -f 0.8.6/k8s/otel_operator_rbac_patch.yaml
Option 2: Install an MdaiHub without cert-manager

This command installs a local kind cluster and an MdaiHub.

mdai --no-cert-manager install --version 0.8.6 -f values/overrides_0.8.6.yaml

Add a role binding for the OpenTelemetry operator

kubectl apply -f 0.8.6/k8s/otel_operator_rbac_patch.yaml

I have a local k8s cluster

Option 1: Install an MdaiHub with cert-manager
For this to work, your existing cluster must have cert-manager installed.

This command installs a local kind cluster and an MdaiHub.

mdai install_mdai --version 0.8.6 -f values/overrides_0.8.6.yaml

Add a role binding for the OpenTelemetry operator

kubectl apply -f 0.8.6/k8s/otel_operator_rbac_patch.yaml
Option 2: Install an MdaiHub without cert-manager

This command installs a local kind cluster and an MdaiHub.

mdai --no-cert-manager install_mdai --version 0.8.6 -f values/overrides_0.8.6.yaml

Add a role binding for the OpenTelemetry operator

kubectl apply -f 0.8.6/k8s/otel_operator_rbac_patch.yaml

Install an MdaiHub

Normally, MDAI clusters run in Kubernetes. You can setup a “cluster” on a single machine using <a href=“https://kind.sigs.k8s.io/docs/user/quick-start/"target="_blank" rel=“noopener”>Kind or a pre-existing cluster. You’ll use Helm charts to bring up the pods in your cluster.

Do you need a Kubernetes cluster? This will help you instantiate one.

This command installs a kind cluster

kind create cluster --name mdai

Install Options

Option 1: With cert-manager

This command installs cert-manager

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml
  kubectl wait --for=condition=Established crd/certificates.cert-manager.io --timeout=60s
  kubectl wait --for=condition=Ready pod -l app.kubernetes.io/instance=cert-manager -n cert-manager --timeout=60s
  kubectl wait --for=condition=Available=True deploy -l app.kubernetes.io/instance=cert-manager -n cert-manager --timeout=60s

This command installs the MdaiHub

helm upgrade --install \
      mdai oci://ghcr.io/decisiveai/ \mdai-hub \
      --namespace mdai \
      --create-namespace \
      --version 0.8.6 \
      --set mdai-operator.manager.env.otelSdkDisabled=true \
      --set mdai-gateway.otelSdkDisabled=true \
      --set mdai-s3-logs-reader.enabled=false \
      --values values/overrides_0.8.6.yaml \
      --cleanup-on-fail

Add a role binding for the OpenTelemetry operator.

kubectl apply -f 0.8.6/k8s/otel_operator_rbac_patch.yaml
Option 2: Without cert-manager

This command installs the MdaiHub without cert-manager

helm upgrade --install mdai-hub oci://ghcr.io/decisiveai/mdai-hub \
      --version 0.8.6 \
      --namespace mdai \
      --create-namespace \
      --set mdai-operator.manager.env.otelSdkDisabled=true \
      --set mdai-gateway.otelSdkDisabled=true \
      --set mdai-s3-logs-reader.enabled=false \
      --set opentelemetry-operator.admissionWebhooks.certManager.enabled=false \
      --set opentelemetry-operator.admissionWebhooks.autoGenerateCert.enabled=true \
      --set opentelemetry-operator.admissionWebhooks.autoGenerateCert.recreate=true \
      --set opentelemetry-operator.admissionWebhooks.autoGenerateCert.certPeriodDays=365 \
      --set mdai-operator.admissionWebhooks.certManager.enabled=false \
      --set mdai-operator.admissionWebhooks.autoGenerateCert.enabled=true \
      --set mdai-operator.admissionWebhooks.autoGenerateCert.recreate=true \
      --set mdai-operator.admissionWebhooks.autoGenerateCert.certPeriodDays=365 \
      --values values/overrides_0.8.6.yaml \
      --cleanup-on-fail

Add a role binding for the OpenTelemetry operator

kubectl apply -f 0.8.6/k8s/otel_operator_rbac_patch.yaml

You’ll see a number of messages as the MDAI Learning Environment cluster components are installed. Once installation is complete, verify that the Learning Environment cluster’s pods are running.

kubectl get pods -n mdai

If your Learning Environment cluster is running, you’ll see output similar to the following.

NAME                                                READY   STATUS    RESTARTS     AGE
alertmanager-kube-prometheus-stack-alertmanager-0   2/2     Running   0            50s
kube-prometheus-stack-operator-686d7d855b-rfsth     1/1     Running   0            59s
mdai-event-hub-5575557f6d-w758s                     1/1     Running   0            59s
mdai-gateway-667c4c5fcc-cbd2z                       1/1     Running   0            59s
mdai-grafana-5ccdcf59c9-tlx5n                       3/3     Running   0            59s
mdai-kube-state-metrics-5bd8cdbccb-tls6s            1/1     Running   0            59s
mdai-nats-0                                         3/3     Running   0            59s
mdai-nats-1                                         3/3     Running   0            59s
mdai-nats-2                                         3/3     Running   0            59s
mdai-nats-box-fb7f9c849-kjtnk                       1/1     Running   0            59s
mdai-operator-controller-manager-7d7b4c9886-qmsjg   1/1     Running   0            59s
mdai-prometheus-node-exporter-fjmdh                 1/1     Running   0            59s
mdai-valkey-primary-0                               1/1     Running   0            59s
opentelemetry-operator-58cb5dbdbb-m8crb             1/1     Running   0            59s
prometheus-kube-prometheus-stack-prometheus-0       2/2     Running   0            50s

Explore MDAI Labs

When you’re done installing the MDAI Learning Environment, visit the Labs Catalog to explore and learn more.