Skip to main content
To optimize your ML/AI workloads, you can use the Run:ai management platform. It dynamically allocates GPU resources, prevents idle GPUs and enables GPU sharing across multiple workloads and users, so that all resources are utilized. This guide explains how to configure your Nebius AI Cloud resources for use in Run:ai.

Costs

Nebius AI Cloud charges you for the following billing items:

Prerequisites

  1. Get a Run:ai account token.
  2. Prepare the environment:
    1. Install and configure the Nebius AI Cloud CLI.
    2. Install Terraform.
    3. Install kubectl and Helm.
    4. Install jq, to extract IDs and tokens from the JSON data returned by the Nebius AI Cloud CLI. For more details, see the jq documentation.
    5. Save the domain name you control to an environment variable:

Steps

Set up a Managed Kubernetes cluster

For this tutorial, a Managed Kubernetes cluster must have:
  • A node group with at least three nodes. Each of these nodes must have a public IP address allocated.
  • A mounted filesystem.
  • NVIDIA® GPU Operator.
To create the necessary resources quickly, use the k8s-training solution for Terraform:
  1. Clone the nebius-solution-library repository from GitHub and go to the k8s-training directory:
  2. Generate an SSH key pair. If you use a custom file name to save the key pair, specify your public key path in terraform.tfvars.
  3. Load the environment variables:
  4. Initialize Terraform to download providers and modules:
  5. Set enable_grafana and enable_prometheus to false, gpu_nodes_assign_public_ip to true and enter your project settings in the k8s-training/terraform.tfvars file, or overwrite the values while applying the configuration:
    The command contains the following parameters:
    • parent_id: Project ID.
    • subnet_id: Subnet ID.
    • region: The project region is displayed in the upper-left corner of the web console, next to your project name.
  6. When the cluster and the nodes are ready, connect to the cluster:

Configure KServe

KServe is an open-source framework for serving ML models on Kubernetes. KServe uses Knative for serverless deployment and the auto-scaling of ML models.
  1. Knative can only run on nodes with public IP addresses. To ensure this, identify nodes without public IPs and cordon them.
    1. Identify nodes:
      If you earlier created nodes without public IP addresses, they will have only InternalIP in the output.
    2. If the resulting list contains nodes with InternalIP only, cordon these nodes:
  2. Install Knative:
  3. Check the result:
    Make sure that the default-domain job reaches the Complete status and the 3scale-kourier-gateway pod is running.

Install operators

  1. Install the Kubeflow Training Operator (also known as Kubeflow Trainer):
  2. Install the MPI Operator:

(Optional) Prepare nodes for installing other applications

If you cordoned nodes without public IP addresses during the KServe installation, uncordon them:

Set up nginx

  1. Get the IP addresses of the nodes:
  2. Install nginx:
  3. In your DNS provider, link your domain name (DOMAIN_NAME) to the public IP address of one of the nodes.

Install and configure Prometheus

(Optional) Install cert-manager

  1. If you don’t have public TLS certificates, install cert-manager:
  2. Create certs.yaml with the certificate resources. You will use it later when you create a TLS secret:

(Optional) Configure a Managed Service for PostgreSQL cluster

Setting up a Managed Service for PostgreSQL cluster is not strictly necessary for using Run:ai, but it’s strongly recommended for production environments.
Create the Managed Service for PostgreSQL cluster in the same region as the Managed Kubernetes cluster. This way they will have network connectivity between them.
  1. Install the postgresql package.
  2. Create a Managed PostgreSQL cluster:
    In this command, specify the network ID.
  3. Configure the Managed Service for PostgreSQL cluster to work with Run:ai:

Create resources

  1. Create namespaces:
  2. Use your email and the token received from Run:ai to create a Kubernetes secret with Run:ai credentials:
  3. If you have not created a Managed Service for PostgreSQL cluster in (Optional) Configure a Managed Service for PostgreSQL cluster, create a password and save it to the PG_PASSWORD environment variable:
  4. Create a Kubernetes secret with Managed Service for PostgreSQL credentials:
  5. Create a TLS secret:
    Make sure that you set up DOMAIN_NAME and EMAIL variables, and run the following set of commands:

Install Run:ai

Update CoreDNS configuration

Managed Kubernetes uses Cilium as it provides eBPF-based networking, load balancing and security policies, and improves overall observability. However, eBPF-based networking can conflict with CoreDNS and cause DNS resolution failures. To ensure proper DNS resolution for Kubernetes services, create and apply a custom ConfigMap:
  1. Create a custom ConfigMap coredns-custom.yaml that rewrites DNS queries to match your $DOMAIN_NAME:
  2. Make sure that you set up the DOMAIN_NAME variable and run the following command:

Install control plane

  1. Install control plane:
  2. Wait until all pods are ready. You can check their status by running the following command:

Create a Run:ai cluster

  1. Go to DOMAIN_NAME in your browser.
  2. Log in with the default credentials:
    • Username: test@run.ai
    • Password: Abcd!234
  3. Immediately change the password in the interface.
  4. Create a new cluster:
    1. In the interface, select the Run:ai version 2.18 and the Same as the control plane cluster location.
    2. Copy the provided command to install the cluster Helm chart.
    3. In your terminal, run the provided command.
You have now deployed Run:ai in the Managed Kubernetes cluster and you can work with it in the Run:ai web interface.

How to delete the created resources

Some of the created resources are chargeable. If you don’t need them, delete these resources, so Nebius AI Cloud doesn’t charge for them:
  • Delete installed operators:
  • Delete the Managed Kubernetes cluster:
  • Delete the Managed PostgreSQL cluster.

Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.