Soperator: A Nebius Slurm cluster running on Kubernetes

Estimated guided hours: 2

Course overview

Slurm schedules cluster jobs; Soperator maintains Slurm on Kubernetes. In six lessons, learn to request resources, choose batch or interactive execution, and follow a job from submission to logs and completion.

You need basic Linux shell knowledge and familiarity with CPUs and GPUs; Slurm and Kubernetes are introduced from first principles. Read in order, or use the lesson objectives to check your readiness. This prepares you for the GPU courses' Slurm labs.

Worked examples and questions require no cluster access or setup. To run an example later, use an authorized cluster's login node and follow its partition, account and resource limits.

1. Slurm turns resource requests into running work

Objective

Explain what Slurm schedules and distinguish the login, controller and worker roles in the path from submitting a job to executing it.

How it works

Slurm is an open-source workload manager developed and maintained by SchedMD. It gives applications access to cluster resources, starts and supervises their work, and queues requests when resources are busy. A job is a request to perform work under an allocation of resources and a time limit. Queuing lets many users share a cluster without manually choosing an unused machine.

The three roles have different responsibilities:

RoleResponsibility
Login nodeProvides a shell for preparing files, submitting requests and inspecting results. It is not the place for a long training run.
ControllerRuns slurmctld, the service that tracks resources and jobs and makes scheduling decisions. It does not execute the training workload.
Worker, or compute nodeRuns slurmd, which accepts assigned work. Its slurmstepd processes supervise job steps and their input/output. CPUs and GPUs here execute the application.

A partition is a named collection of workers with scheduling rules, such as a maximum runtime or permitted users. Partitions may overlap. An allocation is the resources granted to a particular job; a partition is not itself a reservation for you.

For example, suppose two workers each provide one GPU. A request for one GPU on one node can fit on either eligible worker. A request for two GPUs on one node cannot fit merely because the cluster has two GPUs in total. The placement requirement matters as much as the total count.

Your client command contacts Slurm, the controller selects eligible resources, and the worker executes the assigned processes. The controller coordinates work; it is not a relay through which all application data and log bytes flow.

Mental model

The login node is your workbench, the controller assigns resources, and workers execute the application. A request must fit an eligible placement, not just a cluster-wide total.

2. Soperator maintains Slurm inside Kubernetes

Objective

Explain how Soperator's service roles and worker NodeSets relate to Kubernetes resources without confusing pod placement with Slurm job scheduling.

How it works

Soperator is Nebius's open-source Kubernetes operator for Slurm. An operator is a controller that continually compares declared configuration with running resources and reconciles differences. Kubernetes places containers on provisioned machines and manages their lifecycle; Nebius infrastructure supplies the underlying compute resources.

A Kubernetes node is a host for containers. A Pod groups containers that run together on a node. In Soperator, a Slurm worker is represented by a worker Pod; it is not the same object as the underlying Kubernetes node. A Slurm job normally runs within an existing worker environment rather than creating a new Kubernetes Pod for each submitted job.

The component names below follow Soperator 4.1.8, the release used by the course setup. A custom resource extends Kubernetes with a product-specific object. SlurmCluster declares the Slurm cluster. Its spec.slurmNodes configuration, represented by the SlurmNodes type in the source, describes service roles:

SlurmNodes roleWhat it provides
controllerThe slurmctld service and its scheduling configuration/state.
loginSecure Shell (SSH) access and Slurm client tools for users.
accountingWhen enabled, slurmdbd records job/resource history in a database. The database may be external or managed through the MariaDB integration.
restWhen enabled, slurmrestd exposes Slurm's REST application programming interface over HTTP for software clients. Shell commands do not require this interface.
exporterWhen enabled, exposes Slurm metrics for monitoring. It is separate from the scheduler and the accounting database.

A separate NodeSet custom resource describes a group of worker Pods, including their number, placement and container resources. Soperator manages those workers through Kubernetes StatefulSets, which maintain Pods with stable identities. Each worker runs slurmd and registers its configured capacity with Slurm. A NodeSet groups worker infrastructure; a Slurm partition groups workers for scheduling policy. They serve different purposes even when their memberships match.

The host's physical capacity, the worker container's resource budget and a job's Slurm allocation are three different quantities. Kubernetes needs room for system services and other containers, so the worker budget normally leaves some CPU and host memory reserved. A container CPU limit can throttle its work; a memory limit can cause an out-of-memory termination. Administrators must check both Slurm's advertised capacity and the effective worker limits when investigating a resource mismatch.

Supporting components make that environment usable. Shared storage supplies the jail, a common Linux filesystem mounted by the login, controller and worker Pods. Users see this environment in login sessions and jobs running on workers; the controller also accesses shared user information and Slurm configuration. The jail helps keep programs and libraries consistent; special paths such as /tmp and device/process mounts remain node-local. A populate-jail job initializes that filesystem. Persistent storage also holds configuration-dependent state. MUNGE authenticates Slurm messages between trusted components; it does not replace SSH access controls or a user's scheduling permissions.

Health checks help detect unhealthy workers, which may be drained so new jobs avoid them. The optional Slurm exporter and NVIDIA Data Center GPU Manager (DCGM) telemetry provide different views: scheduler state and GPU measurements. Pod recovery does not by itself restore a training process's lost state; the application still needs checkpoints and an appropriate restart strategy.

There are therefore two scheduling decisions: Kubernetes places the worker Pods on hosts, then Slurm assigns application resources within eligible workers. A running Pod alone does not prove its Slurm worker is available for jobs.

Mental model

Soperator maintains the Slurm environment on Kubernetes. SlurmNodes configures services, NodeSets define workers, and Slurm schedules jobs on the resulting eligible resources.

3. Describe the work before requesting resources

Objective

Distinguish jobs, steps and tasks, and calculate the resources requested by a small GPU job without confusing host memory with GPU memory.

How it works

A job step is an execution launched within a job allocation, usually with srun. A task is one process that Slurm launches for that step. A task can create threads or child processes; that does not automatically increase its allocation. For example, one job can run a preparation step, then a training step, reusing its allocated resources.

Write down the process layout before choosing flags:

OptionMeaning
--nodes=2Request two nodes.
--ntasks=2Request two Slurm tasks in total.
--ntasks-per-node=1Request one task on each selected node. Use totals that agree when specifying both task options.
--cpus-per-task=4Request four configured Slurm CPU resources for each task.
--gpus-per-node=1Request one GPU on each node.
--mem=16GRequest 16 GiB of host memory per node, not GPU memory.
--time=00:10:00Set a ten-minute job time limit.
--partition=NAMESelect an eligible partition.
--account=NAMECharge the job to an authorized Slurm account.

With two nodes, one task per node, four CPUs per task and one GPU per node, this request reserves two tasks, eight CPUs and two GPUs in total. With --mem=16G, each node must supply the requested host memory. These are illustrative requests, not universal CPU-to-GPU sizing recommendations. A Slurm CPU can represent a core or hardware thread depending on site configuration.

Increase --cpus-per-task or --mem when a job needs more of the worker's available resources. These flags request a larger Slurm allocation; they do not enlarge the worker container's Kubernetes limits or the underlying machine. If the worker budget is configured too small, the administrator must correct that configuration before a larger job can use the host's remaining capacity.

GPU request options have different scopes. --gpus-per-task=1 ties GPU count to tasks; --gpus-per-node=1 ties it to nodes. The older generic-resource form --gres=gpu:1 also requests GPUs per node. Use the site's supported form rather than stacking equivalent flags. Slurm's --gpus* options require the appropriate resource-selection configuration. GPU visibility and binding depend on the allocated resources and the site's isolation settings; do not overwrite CUDA_VISIBLE_DEVICES to reach unallocated GPUs.

An administrator grants your login identity and Slurm account/partition access. A Linux group controls filesystem permissions; a Slurm account controls scheduling/accounting associations. They are not interchangeable. Keep code, inputs and the required software environment in locations available to workers. Slurm transfers the batch script, not all files it refers to. Soperator's shared jail helps with access, but a login node's local temporary file is still a poor place for a worker's required input.

Mental model

Describe processes first, then reserve their CPUs, GPUs, host memory and time. Resource counts and placement must agree, and requesting capacity does not parallelize the application automatically.

4. Choose batch or interactive execution

Objective

Choose between sbatch, salloc and srun, and explain where commands execute and where their output is written.

How it works

sbatch submits a script and returns a job ID once Slurm accepts it. Acceptance is not completion, and the job may wait in the queue. Slurm later runs one copy of the batch script on an allocated worker. An srun inside that script creates a step and launches its tasks.

Consider this small example, saved as job.sbatch in a shared project directory. It requests one GPU and prints device information; it is not a performance test. The examples use an authorized default partition/account. If your site has no suitable default, add its supplied --partition and --account values.

#!/bin/bash
#SBATCH --job-name=device-check
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=2
#SBATCH --gpus-per-node=1
#SBATCH --mem=4G
#SBATCH --time=00:05:00
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err
set -euo pipefail
srun bash -euc 'hostname; nvidia-smi --query-gpu=name,memory.total --format=csv'

Save this script as job.sbatch in an existing private, worker-accessible working directory. Slurm writes its logs there before the job body starts.

sbatch job.sbatch

%x becomes the job name and %j the job ID. For synthetic job ID 12345, standard output is device-check-12345.out and standard error is device-check-12345.err. The batch working directory defaults to the submission directory; --chdir can select another worker-accessible directory. Without an explicit output path, Slurm normally writes slurm-JOBID.out in that working directory, which explains stray files after submitting from home. #SBATCH lines are Slurm directives: shell variables such as $HOME are not expanded there. Put directives before executable shell lines.

For an interactive session, allocation and execution are separate steps. salloc waits for resources and starts a command or shell for the allocation. Its default shell normally stays on the submitting host; reserving a GPU has not moved that shell to a worker. srun launches the worker-side shell:

salloc --nodes=1 --ntasks=1 --cpus-per-task=2 \
  --gpus-per-node=1 --mem=4G --time=00:10:00
srun --ntasks=1 --pty bash
hostname
nvidia-smi
exit  # Leave the worker shell.
exit  # Leave the salloc shell and release the allocation.

Run these interactively in order, waiting for the allocation before starting the step. --pty supplies a pseudo-terminal for the worker shell. A standalone srun can also request an allocation and execute a command in one operation; it may wait for resources. In an existing allocation, it normally starts a step using that allocation. Interactive output returns to the terminal; batch output follows the configured files. Disconnecting from SSH is not a substitute for explicitly ending an interactive allocation.

Mental model

sbatch schedules a script, salloc reserves resources for an interactive session, and srun launches tasks. Create log destinations before submission and distinguish an accepted request from finished work.

5. Count Slurm tasks and PyTorch workers separately

Objective

Read a two-node PyTorch launch and calculate how many Slurm launcher tasks and GPU training processes it creates.

How it works

A distributed application coordinates multiple processes. A rank identifies one process within that application's group; world size is the group's process count. Slurm and the application's launcher can create different layers of processes, so their counts need not match.

PyTorch's torchrun launches training workers and supplies their distributed environment. One common layout uses one Slurm task per node, with each task running a torchrun launcher that starts one child worker per local GPU.

For two nodes with eight allocated GPUs each, that layout has two Slurm tasks and sixteen training processes: two launchers times eight children. It needs the separate two-eight-GPU environment described in the GPU courses, not the two-one-GPU base cluster. This example explains launch mechanics, not network performance or a complete training program.

Read the following as the body of a batch script whose directives request --nodes=2, --ntasks=2, --ntasks-per-node=1 and --gpus-per-node=8, plus appropriate per-launcher CPUs, host memory and time. The application train.py must already implement distributed training and select its local GPU correctly; this text course does not supply that application.

mapfile -t hosts < <(scontrol show hostnames "$SLURM_JOB_NODELIST")
export MASTER_ADDR="${hosts[0]}"
export MASTER_PORT=29500  # Choose an available, site-permitted port.
srun --ntasks=2 --ntasks-per-node=1 bash -euc '
  torchrun --nnodes=2 --nproc-per-node=8 \
    --node-rank="$SLURM_PROCID" \
    --master-addr="$MASTER_ADDR" --master-port="$MASTER_PORT" \
    train.py
'

Both launchers contact the same first allocated host and port to establish the process group. That address must be reachable between the workers and the port must not collide with another job; it is not a public listener to expose on the internet. The single quotes let each launched shell expand its own SLURM_PROCID, giving launcher ranks zero and one. scontrol show hostnames expands Slurm's compressed node list into individual hostnames.

VariableMeaning in this layout
SLURM_JOB_IDThe allocation's job ID.
SLURM_JOB_NODELISTThe allocated Slurm node names.
SLURM_NTASKSTwo Slurm launcher tasks, not sixteen training ranks.
SLURM_PROCIDEach Slurm task's global index, used here as the launcher node rank.
RANK, LOCAL_RANK, WORLD_SIZESet by torchrun for each child: its global index, local GPU/process index and sixteen-process group size.

A direct Slurm-per-GPU layout is also possible when the application supports that initialization path. Do not combine sixteen Slurm tasks with eight torchrun children per task: that would start 128 training processes and oversubscribe the intended sixteen GPUs. torchrun does not automatically translate every Slurm variable into a correct distributed setup.

Mental model

Count launcher processes and training processes separately. Slurm provides the allocation and launcher placement; torchrun provides the child-worker ranks for the application.

6. Follow a job from queue to completion

Objective

Select the right command for pending, running and completed jobs, then combine scheduler records with application output before deciding what happened.

How it works

Start with the question you need to answer. sinfo describes partitions and nodes; squeue describes current jobs. Use your own user filter and a small output format instead of repeatedly requesting the entire cluster state.

sinfo -o '%P %a %l %D %t %G'
squeue --me -o '%.18i %.12j %.10T %.10M %.6D %R'

The sinfo columns show partition, availability, time limit, node count, node state and generic resources such as GPUs. A star beside a partition marks the default. In the squeue example, columns are job ID, name, state, elapsed time, node count and reason or allocated nodes. These are scheduler facts, not GPU utilization measurements.

A pending job has not started. Resources indicates that the requested resources are currently unavailable; Priority means higher-priority jobs are ahead; Dependency means another condition must finish first. Inspect the request and reason before changing resource counts. A drained or down worker is an administrator investigation, not something a learner should force back into service.

Set job_id to the actual ID returned by your submission; 12345 below is a synthetic example. scontrol show job exposes details such as requested resources, working directory, output paths, state and reason:

job_id=12345
scontrol show job "$job_id"
squeue --steps --jobs="$job_id"

For a running step, sstat can report sampled process-memory and CPU statistics when the site's accounting plugins collect them. --allsteps includes the job's running steps rather than silently selecting one:

sstat --jobs="$job_id" --allsteps \
  --format=JobID,AveCPU,MaxRSS

RSS is resident set size, a process-memory measure. MaxRSS is not total GPU memory and is not a sum across ranks. Missing values can mean unavailable collection, an already-finished step or sampling that missed short work; they do not prove zero resource use. Follow the output path reported by scontrol. For the previous batch example, once the file exists:

tail -n 40 "device-check-${job_id}.out"
tail -n 40 "device-check-${job_id}.err"

After a job leaves squeue, use sacct if persistent accounting is enabled. It reports both the allocation and its steps, including the batch script and numbered srun steps:

sacct --jobs="$job_id" \
  --format=JobID,JobName,State,ExitCode,Elapsed,AllocCPUS,MaxRSS

COMPLETED means Slurm observed successful completion; FAILED, TIMEOUT, OUT_OF_MEMORY and CANCELLED require different explanations. ExitCode contains an exit status and signal separated by a colon; 0:0 means neither indicated failure. Inspect the step records as well as the batch row: a script that ignores a failed command may still exit successfully. Even a clean exit does not prove a correct model, valid output or improved performance. Check the application's own completion and correctness evidence. If accounting is disabled, retain logs and application artifacts; an empty history is not success.

To stop one of your own jobs, first verify its ID and identity with scontrol, then cancel that exact job:

scancel "$job_id"

Cancellation ends work; it is not a diagnostic read. Avoid user-wide cancellation when you mean one job. Likewise, launching another srun step into a busy allocation consumes resources and may wait; it is not passive monitoring. Use queue, accounting and log queries first. Avoid tight polling loops that unnecessarily load the controller.

Mental model

Use sinfo for capacity, squeue and scontrol for current state, sstat for available live step statistics, and sacct plus logs for history. Always match the evidence to the exact job and verify application success separately.

Where to Go Next

Choose an optional direction that matches the work you want to do next.

  • Continue with a GPU course

    Use the course switcher to read GPU Performance Tools, then PyTorch for GPU Performance Engineering before GPU Fundamentals. The tools reference introduces the profiler commands and evidence used in labs. When you choose to run a practical lab, follow Lab Preparation for the single setup command and completion summary. Use the owning course's lab guides for exact resource requests and performance investigations. This introduction explains the scheduler behavior behind those commands.

  • Explore job arrays

    For larger collections of similar independent jobs, study Slurm job arrays: an array associates indexed instances with one submission, and a concurrency limit bounds simultaneous execution. Ask how input selection and output naming must change so instances do not overwrite one another.

  • Coordinate dependent jobs

    For pipelines, study Slurm dependencies: a downstream job can wait for an upstream outcome instead of using a shell polling loop. Ask when successful process exit is sufficient and when an application artifact must also be checked.

  • Read the administrator references

    For cluster administrators, the versioned Soperator API and Helm chart sources explain deployment options and reconciliation. Reading them does not require changing a cluster. Keep user job investigation separate from administrative changes to workers, partitions or accounts. Public references follow below.

Glossary

Account
Slurm association used for charging usage and applying scheduling policy; separate from a Linux group.
Allocation
Resources granted to a job for a limited time.
Controller
Slurm scheduling service, slurmctld.
Custom resource
An extension to the Kubernetes API that represents an application-specific object; a controller can reconcile that object into running resources.
DCGM
NVIDIA Data Center GPU Manager; provides GPU health and telemetry facilities.
Jail
Soperator's shared Linux user filesystem, with some special/node-local paths excluded.
Job
A scheduled request for work and its resource allocation.
Job step
An execution within an allocation, commonly launched by srun.
Kubernetes node
A worker machine, physical or virtual, on which Kubernetes runs Pods.
Login node
User entry point for preparing and submitting work and reading results.
MUNGE
Credential service used to authenticate messages between trusted Slurm components.
NodeSet
Soperator custom resource describing a group of worker Pods.
Operator
Kubernetes controller that reconciles declared and observed application resources.
Partition
Named collection of Slurm workers and scheduling rules; not a private allocation.
Pod
Kubernetes unit grouping containers placed together on a host.
Rank / world size
A distributed application's process index / total process count.
REST API
HTTP interface for programmatic Slurm access through optional slurmrestd.
RSS
Resident set size; process memory resident in host RAM, not GPU memory.
Slurm CPU
A schedulable CPU resource whose core/thread interpretation depends on the site.
SlurmCluster / SlurmNodes
Cluster custom resource / its service-role configuration type.
StatefulSet
Kubernetes workload resource maintaining Pods with stable identities.
Task
A process launched by Slurm; it may itself launch child processes.
Worker
Slurm compute environment running slurmd and assigned application work.

Official references

  1. SchedMD: Slurm overview
  2. SchedMD: Quick start user guide
  3. SchedMD: sbatch
  4. SchedMD: salloc
  5. SchedMD: srun
  6. SchedMD: CPU management
  7. SchedMD: GPU and generic resource scheduling
  8. SchedMD: slurmstepd
  9. SchedMD: sinfo
  10. SchedMD: squeue
  11. SchedMD: scontrol
  12. SchedMD: sstat
  13. SchedMD: sacct
  14. SchedMD: scancel
  15. SchedMD: Job state codes
  16. SchedMD: Job reason codes
  17. SchedMD: Job exit codes
  18. SchedMD: Job arrays
  19. Kubernetes: Container resource requests, limits and node allocatable capacity
  20. Nebius Solutions Library: Soperator system-resource reserve policy
  21. Nebius: Soperator repository
  22. Nebius: Soperator 4.1.8 architecture
  23. Nebius: SlurmCluster and SlurmNodes types, 4.1.8
  24. Nebius: Worker NodeSet type, 4.1.8
  25. Nebius: Slurm service chart configuration, 4.1.8
  26. Nebius: Worker NodeSet chart configuration, 4.1.8
  27. Nebius: Controller jail mount, 4.1.8
  28. Nebius: Controller shared users and Slurm configuration, 4.1.8
  29. PyTorch: torchrun documentation and implementation