Slurm on OpenShift
Slurm (Simple Linux Utility for Resource Management) is the most widely used workload manager in HPC. It provides job scheduling, resource management, and accounting for compute clusters, and is the standard in national labs, universities, and enterprises running HPC workloads.
The Slinky project brings Slurm to Kubernetes and OpenShift, running the Slurm control plane and compute nodes as containers on the platform. This module introduces the architecture, use cases, and practical considerations for running Slurm on OpenShift.
| Running Slurm on OpenShift via the Slinky project is not a supported Red Hat product. It is an open-source community project for exploration and evaluation. Production HPC workloads running on Slurm should be evaluated carefully for supportability, and organizations should engage with Red Hat to understand the support boundaries. This workshop section is provided for educational and evaluation purposes. |
Why Run Slurm on OpenShift?
Organizations considering Slurm on OpenShift typically fall into one of these categories:
-
HPC modernization — You have existing Slurm-based workflows, scripts, and user expectations. Running Slurm on OpenShift lets you modernize the infrastructure without rewriting job scripts or retraining users.
-
Hybrid workloads — You want both Kubernetes-native workloads (microservices, AI/ML inference) and traditional HPC batch jobs on the same platform, sharing the same hardware.
-
Operational unification — A single platform for your operations team to manage, with consistent security, networking, and monitoring — rather than maintaining separate Kubernetes and HPC clusters.
-
Evaluation — You want to understand what running Slurm on Kubernetes looks like before committing to a migration strategy.
Architecture
The Slinky project deploys Slurm components as Pods on OpenShift:
Slurm Control Plane
-
slurmctld — The central management daemon. Runs as a Pod (often a StatefulSet) with persistent storage for job accounting and state.
-
slurmdbd — The Slurm database daemon for job accounting. Connects to a database (typically MariaDB or MySQL) running as another Pod or an external service.
Compute Nodes
-
slurmd — The compute node daemon. Each slurmd Pod represents a compute node available for running jobs. These Pods register with slurmctld and report their resources (CPU, memory, GPUs).
How It Differs from Bare-Metal Slurm
Running Slurm on OpenShift is not identical to running it on bare metal. Key differences:
| Aspect | Bare-Metal Slurm | Slurm on OpenShift |
|---|---|---|
Compute nodes |
Physical or virtual machines with slurmd installed |
slurmd Pods on OpenShift worker nodes |
Resource management |
Slurm directly manages CPU, memory, GPU on the node |
Slurm manages resources within the Pod’s cgroup limits; OpenShift manages the underlying node |
User access |
SSH to login nodes, then |
Access via OpenShift terminal, port-forward, or a login Pod |
Storage |
Shared filesystem (NFS, Lustre, GPFS) |
PersistentVolumes (NFS, CephFS, or other CSI drivers) |
GPU support |
Direct device access via |
GPU access via Kubernetes device plugin and resource requests |
Node scaling |
Add/remove physical machines |
Scale slurmd StatefulSet replicas |
Exercise 1: Exploring Slurm on OpenShift
| This exercise requires the Slinky project to be deployed on your cluster. See slinky-on-openshift for deployment instructions. |
Verify the Slurm deployment
-
Check the Slurm control plane Pods:
oc get pods -n slurm -l app=slurmctld oc get pods -n slurm -l app=slurmdbd -
Check the compute node Pods:
oc get pods -n slurm -l app=slurmdYou should see multiple slurmd Pods, each representing a compute node.
-
Access the Slurm login environment. You can exec into the slurmctld Pod or a dedicated login Pod:
oc exec -it -n slurm deploy/slurmctld -- /bin/bash
Check cluster status
-
Inside the Slurm environment, check the cluster info:
sinfoYou should see the partition name, node list, and state (idle, allocated, etc.).
-
Check the node details:
scontrol show nodesEach node corresponds to a slurmd Pod. Notice that the resources reported (CPUs, memory) match the Pod’s resource limits.
Exercise 2: Submitting Slurm Jobs
With the Slurm environment accessible, you can submit jobs using the standard Slurm commands that HPC users already know.
-
Submit a simple batch job:
sbatch <<'JOBSCRIPT' #!/bin/bash #SBATCH --job-name=hello-ocp #SBATCH --nodes=1 #SBATCH --ntasks=1 #SBATCH --time=00:05:00 echo "Hello from Slurm on OpenShift!" echo "Running on node: $(hostname)" echo "Date: $(date)" echo "Job ID: $SLURM_JOB_ID" JOBSCRIPT -
Check the job queue:
squeue -
Wait for the job to complete, then view the output:
cat slurm-*.out
Submit a parallel job
-
Submit a multi-node MPI-style job:
sbatch <<'JOBSCRIPT' #!/bin/bash #SBATCH --job-name=parallel-test #SBATCH --nodes=2 #SBATCH --ntasks-per-node=2 #SBATCH --time=00:05:00 echo "Parallel job starting on $(hostname)" echo "SLURM_JOB_NODELIST: $SLURM_JOB_NODELIST" echo "SLURM_NTASKS: $SLURM_NTASKS" srun hostname JOBSCRIPT -
Monitor the job:
squeue -
View the results:
cat slurm-*.outYou should see hostnames from multiple slurmd Pods, confirming that the job ran across multiple compute nodes.
Exercise 3: Scaling Compute Nodes
One advantage of running Slurm on OpenShift is the ability to dynamically scale compute nodes by adjusting the slurmd StatefulSet.
-
Check the current number of compute nodes:
oc get statefulset -n slurm -l app=slurmd -
Scale up the compute nodes:
oc scale statefulset slurmd -n slurm --replicas=4 -
Watch the new slurmd Pods come up:
oc get pods -n slurm -l app=slurmd -wPress
Ctrl+Conce all Pods are Running. -
Verify Slurm sees the new nodes:
oc exec -n slurm deploy/slurmctld -- sinfoThe new nodes should appear in the partition.
-
Scale back down when done:
oc scale statefulset slurmd -n slurm --replicas=2
Considerations and Limitations
Running Slurm on OpenShift involves trade-offs:
-
Supportability — Slinky is a community project. Red Hat does not provide commercial support for Slurm itself. The OpenShift platform underneath is supported, but Slurm issues are out of scope for Red Hat support.
-
Performance — Containerized Slurm adds a layer of abstraction. For latency-sensitive HPC workloads (e.g., tightly coupled MPI with high message rates), bare-metal Slurm with RDMA/InfiniBand may be necessary.
-
Storage — Shared filesystems are critical for HPC. You need a CSI driver that provides POSIX-compatible shared storage (NFS, CephFS, Lustre CSI).
-
Security context — Some Slurm operations require elevated privileges (e.g., cgroup management, user switching). OpenShift’s security context constraints (SCCs) may need adjustment.
-
GPU access — GPU scheduling works through the Kubernetes device plugin, which may differ from Slurm’s native
gres.confGPU management.
Summary
Slurm on OpenShift via the Slinky project provides a way to run the most widely used HPC workload manager on a cloud-native platform.
In this module you:
-
Understood the architecture — Slurm control plane and compute nodes running as Pods.
-
Submitted batch and parallel jobs using standard Slurm commands (
sbatch,srun,squeue,sacct). -
Scaled compute nodes dynamically by adjusting StatefulSet replicas.
-
Reviewed the considerations and limitations including supportability, performance, and storage.
This approach is valuable for evaluating how traditional HPC workflows can run on OpenShift and for organizations that want to maintain Slurm compatibility while modernizing their infrastructure.
In the next section, you will learn about the Flux Framework on OpenShift — a next-generation alternative to Slurm with hierarchical scheduling and graph-based resource management.