Skip to main content
To optimize your AI and ML 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 to make full use of available resources. In this tutorial, you will install Run:ai on a Managed Service for Kubernetes cluster and configure the deployment by using the NVIDIA Run:ai installer.
You can also deploy Run:ai from the Applications marketplace to get started with minimal manual setup. The application provides a Nebius public endpoint, so you don’t need to configure your own domain, DNS, ingress controller, or TLS certificates. Follow this tutorial if you need to configure these manually.
This tutorial is based on Run:ai installer version 3.0.20. This version is open-source and doesn’t require registry credentials. For NVIDIA’s paid Support-Entitled Release, see its registry credentials instructions.

Costs

Nebius AI Cloud charges you for the following billing items:

Prerequisites

  1. Install and configure the tools:
    1. Install and configure the Nebius AI Cloud CLI.
    2. Install Terraform.
    3. Install kubectl and Helm version 3.14 or higher.
    4. Install jq, which the k8s-training solution’s environment script uses to parse JSON data returned by the Nebius AI Cloud CLI:
  2. Prepare a domain name you control with access to its public DNS records.

Steps

Set up a Managed Kubernetes cluster

Use the k8s-training solution for Terraform to create a Managed Kubernetes cluster with:
  • A CPU node group with three nodes, each with 8 vCPUs and 32 GiB of RAM.
  • A GPU node group with one node. The solution selects the GPU platform and preset for your region.
  • A shared filesystem mounted on the nodes.
  • NVIDIA GPU Operator.
  • NVIDIA Network Operator.
The nodes use private IP addresses.
  1. Clone the solution repository and go to the k8s-training directory:
  2. Generate an SSH key pair.
  3. Create terraform.tfvars with the following configuration:
    This configuration creates three CPU nodes with 8 vCPUs and 32 GiB of RAM each, one GPU node, and a mounted 100 GiB shared filesystem. It also enables GPU Operator to manage the GPU driver and Container Toolkit.
  4. Create runai_override.tf in the same directory:
    This Terraform override file enables the NVIDIA Data Center GPU Manager (DCGM) exporter in the solution’s existing GPU Operator module.
  5. Set the following environment variables for the solution and your Run:ai deployment:
    • NEBIUS_TENANT_ID: Tenant ID.
    • NEBIUS_PROJECT_ID: Project ID.
    • NEBIUS_REGION: Project region, as displayed in the list of projects in the web console. You can configure a Managed Service for PostgreSQL cluster if you don’t want to use the PostgreSQL database the Run:ai installer deploys in your Kubernetes cluster. In that case, choose a project in a supported region and use that region.
    • DOMAIN_NAME: Domain for the Run:ai web interface and workload subdomains.
    • NEBIUS_VPC_SUBNET_ID (optional): Subnet ID for the cluster nodes. If you don’t set it, the solution’s environment script selects the default subnet in the project’s default network.
    The NEBIUS_* variables configure the solution’s Terraform environment. DOMAIN_NAME specifies the domain for Run:ai DNS and TLS configuration.
  6. Load the Terraform environment:
    The script uses the subnet from NEBIUS_VPC_SUBNET_ID or, if the variable isn’t set, selects the default subnet. It then prepares an Object Storage bucket for Terraform state and creates the k8s-training-sa service account. It adds the service account to the editors group in the tenant and sets the Terraform inputs from the environment variables.
  7. Initialize Terraform in the working directory:
  8. Apply the changes:
  9. Connect to the k8s-training cluster:
    The command adds the cluster to your kubeconfig and selects it as the current context. The kubectl, helm, and runai-installer commands in the rest of this tutorial run against this cluster.

Install an ingress controller and configure DNS

Run:ai requires an ingress controller. This tutorial uses HAProxy Kubernetes Ingress Controller, following NVIDIA’s networking setup.
  1. Install HAProxy with a Service of type LoadBalancer:
    Managed Kubernetes allocates a public IP address for the load balancer. The ingress class is haproxy; you will reference it in the installer configuration.
  2. Get the load balancer’s IP address from the EXTERNAL-IP column:
    Wait until an address appears.
  3. In your DNS provider, create public DNS records pointing to this IP address for both your domain (<domain_name>) and its wildcard (*.<domain_name>). If you want to enable Knative inference endpoints to let applications outside the cluster send requests to your models, also configure a wildcard inference domain, for example *.runai-inference.<domain_name>, pointing to the same address. Allow time for the DNS changes to propagate before running the installer.

Prepare TLS certificates

The installer reads local PEM files and creates TLS Secrets for Run:ai. The certificate must cover both your domain (<domain_name>) and its wildcard (*.<domain_name>). The example installer configuration in this tutorial uses this certificate for both the control plane and cluster, including host-based workload routing. For details, see NVIDIA’s domain and certificate requirements. To prepare the certificate files:
  1. Get the certificate chain and matching private key files in PEM format. Use existing certificate files, or obtain them with cert-manager.
    1. Install cert-manager with Helm.
    2. Configure a DNS-01 solver for your DNS provider and request a certificate covering both <domain_name> and *.<domain_name>. HTTP-01 validation can’t issue wildcard certificates.
    3. Wait until the certificate is ready, then export its certificate chain and private key from the secret to local PEM files:
      Replace <certificate_secret_name> with the certificate’s spec.secretName and <namespace> with its namespace.
  2. Save the files on the local machine where you will run the Run:ai installer. If a private certificate authority signed your certificates, also save its certificate authority chain file.
  3. (Optional) If you enable Knative inference endpoints for access from outside the cluster, also obtain a certificate covering the wildcard inference domain.

(Optional) Configure a Managed PostgreSQL cluster

By default, the Run:ai installer deploys a PostgreSQL 16 database inside the Kubernetes cluster for the Run:ai control plane. Alternatively, you can create your own Nebius Managed PostgreSQL cluster.
Create the Managed PostgreSQL cluster in the same region and network as the Managed Kubernetes cluster.
To deploy a Managed PostgreSQL cluster and prepare its credentials for Run:ai:
  1. Install the postgresql package.
  2. Get the ID of the network that includes the Managed Kubernetes cluster’s subnet:
  3. Create a Managed PostgreSQL cluster in the same network. In the command, set <network_ID> to the ID you received in the previous step:
    The command creates a PostgreSQL 16 cluster, the only version Run:ai supports, with the runai database and user for Run:ai.
  4. Get the private read-write endpoint and save it to PG_ENDPOINT:
  5. Create a namespace and a Secret with the password that the cluster creation command saved to PG_PASSWORD:
In the next step, you also need to disable the bundled PostgreSQL database and configure Run:ai to connect to your Managed PostgreSQL cluster.

Install Run:ai

Download the installer

In the k8s-training directory, download the Run:ai installer for your operating system and architecture. To follow the commands in this tutorial, rename the downloaded binary to runai-installer:
Replace <os> with linux or darwin, and <arch> with amd64 or arm64, matching the filename you downloaded.

Prepare the installer configuration

Create a configuration that installs Run:ai on the Managed Kubernetes cluster, uses your TLS certificates, and installs Prometheus. GPU Operator is already installed by the k8s-training solution.
To use GPU fractions, the installed GPU Operator, driver, and Container Toolkit must meet NVIDIA’s GPU fractions requirements. Check that your configuration meets the requirements separately from the basic setup for workloads that use whole GPUs.
Create config.yaml:

config.yaml

In the configuration, set the following: If you use Managed PostgreSQL or want to enable Knative inference endpoints, apply the additional configuration below:
If you created a Managed PostgreSQL cluster, replace controlPlane.customHelmValues: {} with the following map under controlPlane. Replace <postgresql_endpoint> with the value of PG_ENDPOINT:
postgresql.enabled: false disables the bundled PostgreSQL database. The global.postgresql.auth.* settings connect Run:ai to the Managed PostgreSQL cluster. For SSL configuration, see NVIDIA’s PostgreSQL configuration reference. Run:ai doesn’t support PostgreSQL SSL mode prefer.
Knative Serving enables standard single-node inference workloads. To expose these workloads externally, replace the features block with:
Add the following inference block under cluster, by using the wildcard inference domain you configured in DNS and the absolute paths to its certificate and key:
For details, see NVIDIA’s networking setup.

Run the installer

Run the following commands from the directory containing runai-installer and config.yaml.
  1. Validate the configuration against the cluster and run preflight checks:
  2. Review the installation plan without applying changes:
  3. Run the installation:
    The installer deploys Run:ai into the Managed Kubernetes cluster you connected to earlier. It installs prerequisites, enabled features, the control plane, and cluster components, and registers the k8s-training cluster with the control plane. During installation, it generates the credentials that are required to log in to Run:ai.
  4. Check the Pods:
    Wait until each Pod is Running with a complete READY count or has finished with status Completed.
For installer parameters and troubleshooting, see NVIDIA’s command reference.

Log in to Run:ai

  1. Retrieve the administrator username and password the Run:ai installer generated:
  2. Open https://<domain_name> in your browser, replacing <domain_name> with your domain. The UI can take up to 15 minutes to become reachable.
  3. Log in with the credentials and change the password.
  4. Verify that the k8s-training cluster shows Connected in the control plane. If it doesn’t, see NVIDIA’s cluster troubleshooting guide.
You can now manage workloads in the Run:ai UI.

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. The terraform destroy command deletes only the resources that Terraform created: the Managed Kubernetes cluster, its node groups, and the shared filesystem. The environment.sh script creates the bucket by using the Nebius AI Cloud CLI, and the cluster creates disks for Run:ai persistent volumes. The following steps delete all of these resources:
  1. Uninstall HAProxy:
    Wait for the command to complete before continuing. It deletes the HAProxy LoadBalancer Service so that Managed Kubernetes can remove the load balancer and its automatically managed public IP allocation.
  2. Go to the k8s-training directory of the cloned repository and run the environment.sh script again:
    Terraform reads the project and subnet IDs, the IAM access token, and the access key to the bucket with the Terraform state from environment variables that the script sets. These variables exist only in the terminal session where you ran the script, and the token and the key expire. The script sets the variables again.
  3. Get the ID of the Managed Kubernetes cluster:
    Save the received ID. The disks of the Run:ai persistent volumes have the cluster ID in their labels. After Terraform deletes the cluster, use this ID to find these disks.
  4. Delete the resources that Terraform created:
    If the command fails while uninstalling a Helm release, run it again.
  5. Get the IDs of the disks that the cluster created for Run:ai persistent volumes:
  6. Delete the disks with these IDs.
  7. Delete the Managed PostgreSQL cluster if you used it.
  8. Delete the bucket that stores the Terraform state. Its name starts with tfstate-k8s-training-.

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