AI & GPU advanced ⏱ 45 minutes K8s 1.30+

Run Slurm on OpenShift with the Slinky Operator

Deploy Slurm on OpenShift with the Slinky slurm-operator: OperatorHub or Helm install, anyuid vs privileged SCC, auth secrets, Controller and NodeSet CRs, jobs.

By Luca Berton • • 📖 10 min read

💡 Quick Answer: On OpenShift the Slinky slurm-operator installs from OperatorHub (“Slurm Operator”, Red Hat HPC community) or with Helm. The OpenShift-specific part is security: Slurm runs as UID 401 and needs at least the anyuid SCC on the default ServiceAccount in the slurm namespace (the redhat-hpc/slinky-on-openshift pattern uses privileged for full-featured workers and login pods). Create the slurm.key and JWT secrets, apply a Controller and a NodeSet, then sbatch from the controller or a login pod.

The Problem

The upstream Slinky install assumes vanilla Kubernetes. On OpenShift it fails in predictable ways:

  • Pods never start — the restricted-v2 SCC assigns a random UID, but Slurm daemons expect the slurm user (UID 401) and write to fixed paths
  • slurmd can’t manage cgroups or devices — without extra privileges, job isolation and GPU binding don’t work
  • No obvious login path — the login Service is type: LoadBalancer, which on-prem clusters often lack
  • Two install paths — OperatorHub (console) or Helm (CLI), and the docs mix them

The Solution

Choose your SCC level

SCCWhat worksSource
anyuidController + basic CPU workers, sbatch/srun from the controller podRed Hat Developer article (Mar 2026)
privilegedEverything above plus login pods with sshd, cgroup-constrained jobs, GPU workersredhat-hpc/slinky-on-openshift

Start with anyuid for a functional test. Move to privileged (scoped to the slurm namespace only) when you need login nodes or GPUs. A tighter, purpose-built SCC is on the Red Hat HPC team’s roadmap.

Step 1: Install the operator

Option A — Console (OperatorHub / Software Catalog):

  1. Ecosystem → Software Catalog, search slurm, pick Slurm Operator (Red Hat HPC community).
  2. Installation mode: A specific namespace on the cluster; create namespace slinky.
  3. Channel: latest (stable or alpha), approval Automatic. Wait for Succeeded.

Option B — Helm:

helm install slurm-operator-crds \
  oci://ghcr.io/slinkyproject/charts/slurm-operator-crds \
  --namespace slinky --create-namespace --server-side=false

helm install slurm-operator \
  oci://ghcr.io/slinkyproject/charts/slurm-operator \
  --namespace slinky --wait

Either way, cert-manager must already be installed (use the cert-manager Operator for Red Hat OpenShift from the catalog).

Step 2: Namespace, SCC and auth secrets

oc new-project slurm

# Minimum: Slurm needs its fixed UID
oc adm policy add-scc-to-user anyuid -z default -n slurm
# Or, for login pods / GPU workers:
# oc adm policy add-scc-to-user privileged -z default -n slurm

# Slurm auth key and slurmrestd JWT key
oc create secret generic slurm-auth-slurm -n slurm \
  --from-literal=slurm.key="$(openssl rand -base64 32)"
oc create secret generic slurm-auth-jwths256 -n slurm \
  --from-literal=jwt_hs256.key="$(openssl rand -base64 32)"

⚠️ Don’t recreate slurm-auth-slurm on a running cluster. Every daemon must share the same key; rotating it means restarting the controller and all workers.

Step 3: Create the Controller and NodeSet

This is the path the OperatorHub install uses (no slurm Helm chart):

# slurm-cluster.yaml
apiVersion: slinky.slurm.net/v1beta1
kind: Controller
metadata:
  name: slurm
  namespace: slurm
spec:
  slurmKeyRef:
    name: slurm-auth-slurm
    key: slurm.key
  jwtHs256KeyRef:
    name: slurm-auth-jwths256
    key: jwt_hs256.key
  slurmctld:
    image: ghcr.io/slinkyproject/slurmctld:25.11-ubuntu24.04
    resources:
      requests: {cpu: "2", memory: 4Gi}
      limits:   {cpu: "4", memory: 8Gi}
  persistence:
    enabled: true
    resources:
      requests:
        storage: 4Gi
    accessModes: [ReadWriteOnce]
  reconfigure:
    image: ghcr.io/slinkyproject/slurmctld:25.11-ubuntu24.04
    resources: {}
  logfile:
    image: docker.io/library/alpine:latest
    resources: {}
  extraConf: |
    PartitionName=all Nodes=ALL Default=YES MaxTime=UNLIMITED State=UP
    # Keep finished jobs visible to scontrol for 1h (default 300s)
    MinJobAge=3600
---
apiVersion: slinky.slurm.net/v1beta1
kind: NodeSet
metadata:
  name: slurm-worker-slinky
  namespace: slurm
spec:
  controllerRef:
    name: slurm
    namespace: slurm
  replicas: 2
  partition:
    enabled: true
  slurmd:
    image: ghcr.io/slinkyproject/slurmd:25.11-ubuntu24.04
    # Resources go under spec.slurmd.resources — NOT spec.resources
    resources:
      requests: {cpu: "1", memory: 2Gi}
      limits:   {cpu: "2", memory: 4Gi}
    env:
      - name: POD_CPUS
        value: "0"
      - name: POD_MEMORY
        value: "0"
  logfile:
    image: docker.io/library/alpine:latest
    resources: {}
  template:
    spec:
      hostname: slinky-        # Slurm node names become slinky-0, slinky-1, ...
      nodeSelector:
        kubernetes.io/os: linux
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 100%
oc apply -f slurm-cluster.yaml
oc get pods -n slurm -w
# slurm-controller-0        3/3  Running
# slurm-worker-slinky-0     2/2  Running
# slurm-worker-slinky-1     2/2  Running

Startup takes 1–3 minutes; workers sit in Init until slurmctld answers. In the console, create the NodeSet from Installed Operators → Slurm Operator → NodeSet, never via Create Deployment.

Field names can shift between operator releases — check oc explain controller.spec and oc explain nodeset.spec against your installed CRDs.

You can run more than one slurmd pod on the same OpenShift worker. Slurm sees them as separate compute nodes, but they share the node’s CPU, memory, GPUs and network. Set requests and limits carefully if you do, or keep one worker pod per node, which is what the operator assumes at scale.

Step 4: Submit a job

Without a LoginSet, the controller pod acts as your login node: it has sbatch, srun, squeue and scontrol. First confirm Slurm sees the workers:

CONTROLLER_POD=$(oc get pods -n slurm -l app.kubernetes.io/name=slurmctld \
  -o jsonpath='{.items[0].metadata.name}')
oc exec -n slurm $CONTROLLER_POD -c slurmctld -- sinfo
# PARTITION            AVAIL  TIMELIMIT  NODES  STATE NODELIST
# slurm-worker-slinky     up   infinite      2   idle slinky-[0-1]
# all*                    up   infinite      2   idle slinky-[0-1]

Each NodeSet with partition.enabled: true gets its own partition; all comes from extraConf.

Submit a job and find its output. With no shared filesystem, --output is written on the worker that ran the job, not on the controller:

oc exec -n slurm slurm-controller-0 -c slurmctld -- \
  sbatch --output=/tmp/test-job.out \
  --wrap="echo 'Hello from Slurm!' && hostname && date"
# Submitted batch job 11

oc exec -n slurm slurm-controller-0 -c slurmctld -- scontrol show job 11 | grep -E "JobState|NodeList"
#    JobState=COMPLETED Reason=None ...
#    NodeList=slinky-0

oc exec -n slurm slurm-worker-slinky-0 -c slurmd -- cat /tmp/test-job.out

Request specific resources and check what was allocated:

oc exec -n slurm slurm-controller-0 -c slurmctld -- \
  sbatch --cpus-per-task=1 --mem=1G --output=/tmp/resource-job.out \
  --wrap="nproc && free -h"

oc exec -n slurm slurm-controller-0 -c slurmctld -- \
  scontrol show job <JOB_ID> | grep -E "ReqTRES|AllocTRES"
#    ReqTRES=cpu=1,mem=1G,node=1,billing=1
#    AllocTRES=cpu=2,mem=1G,node=1,billing=2

AllocTRES=cpu=2 for a 1-CPU request is normal on hyperthreaded nodes: Slurm allocates whole cores, and each core here has 2 threads (S:C:T=1:8:2 in sinfo -N -l).

Submit a batch script (here embedding a Python program):

oc exec -i -n slurm slurm-controller-0 -c slurmctld -- \
  bash -c 'cat > /tmp/pyjob.sh' <<'EOF'
#!/bin/bash
#SBATCH --job-name=pyjob
#SBATCH --output=/tmp/pyjob.out
python3 - <<'PY'
import statistics
data = [i % 10 for i in range(1000)]
print("Mean:", statistics.mean(data), "Stdev:", statistics.stdev(data))
PY
EOF

oc exec -n slurm slurm-controller-0 -c slurmctld -- sbatch /tmp/pyjob.sh
oc exec -n slurm slurm-controller-0 -c slurmctld -- squeue

Step 5: Scale the NodeSet

oc scale nodeset slurm-worker-slinky -n slurm --replicas=4
oc exec -n slurm slurm-controller-0 -c slurmctld -- sinfo -N -l
# slinky-[0-3] appear as idle — dynamic nodes, no slurm.conf edit

oc scale nodeset slurm-worker-slinky -n slurm --replicas=2
# nodes being removed are drained first; running jobs finish

For load-based scaling, drive the NodeSet with KEDA on Slurm’s Prometheus metrics. See Slurm GPU workloads with Slinky.

⚠️ In the Red Hat walkthrough, workers with pod limits of 2 CPU / 4 Gi register in sinfo with the host’s 16 CPUs and ~63 GB, and a job with no --mem is given all of that memory (ReqTRES=mem=63274M). Slurm can then place more work in the pod than its cgroup limit allows. In production, either size slurmd to (almost) the whole node, or set DefMemPerCPU in extraConf and keep pod requests aligned with what Slurm advertises.

Alternative: the full Helm pattern with login pods

The redhat-hpc/slinky-on-openshift repo deploys the whole cluster with the upstream slurm chart, a privileged LoginSet and (optionally) CentOS Stream 9 + OpenHPC images from quay.io/slinky-on-openshift:

oc adm new-project slurm
oc adm policy add-scc-to-user privileged -n slurm -z default

helm install slurm oci://ghcr.io/slinkyproject/charts/slurm --namespace=slurm \
  --version 1.0.1 \
  --set configFiles.gres\\.conf="AutoDetect=nvidia" \
  --set loginsets.slinky.enabled=true \
  --set loginsets.slinky.login.securityContext.privileged=true \
  --set nodesets.slinky.replicas=3 \
  --set nodesets.slinky.slurmd.resources.requests.cpu=15 \
  --set nodesets.slinky.slurmd.resources.limits.cpu=15 \
  --set nodesets.slinky.slurmd.resources.requests.memory=56Gi \
  --set nodesets.slinky.slurmd.resources.limits.memory=60Gi \
  --set-literal loginsets.slinky.rootSshAuthorizedKeys="$(cat $HOME/.ssh/id_ed25519.pub)"

To use the OpenHPC images (with modules such as nccl-tests and MPI), add the per-daemon overrides, e.g. --set nodesets.slinky.slurmd.image.repository=quay.io/slinky-on-openshift/slurmd --set nodesets.slinky.slurmd.image.tag=25.11.1-centos9-ohpc, and the same for slurmctld, slurmrestd, slurmdbd and login. Keep every tag identical.

SSH in without a LoadBalancer by tunnelling through the API server:

ssh -o ProxyCommand='oc exec -i -n slurm svc/%h -- socat STDIO TCP:localhost:22' \
  root@slurm-login-slinky

sinfo
srun -n 1 -t 1:00 hostname

Shared /home on OpenShift Data Foundation

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: shared-home
  namespace: slurm
spec:
  accessModes: [ReadWriteMany]
  resources:
    requests:
      storage: 500Gi
  storageClassName: ocs-storagecluster-cephfs
  --set-json 'loginsets.slinky.login.volumeMounts=[{"name":"shared-home","mountPath":"/home"}]' \
  --set-json 'loginsets.slinky.podSpec.volumes=[{"name":"shared-home","persistentVolumeClaim":{"claimName":"shared-home"}}]' \
  --set-json 'nodesets.slinky.slurmd.volumeMounts=[{"name":"shared-home","mountPath":"/home"}]' \
  --set-json 'nodesets.slinky.podSpec.volumes=[{"name":"shared-home","persistentVolumeClaim":{"claimName":"shared-home"}}]'

Common Issues

Pods stuck Pending / CreateContainerConfigError

The SCC wasn’t granted to the ServiceAccount the pods actually use. Check which SCC admitted the pod:

oc get pod slurm-controller-0 -n slurm -o jsonpath='{.metadata.annotations.openshift\.io/scc}'

If it says restricted-v2, re-run oc adm policy add-scc-to-user anyuid -z default -n slurm and delete the pod.

Certificate or webhook errors when creating CRs

cert-manager isn’t healthy. Check oc get pods -n cert-manager. Also make sure your manifests use the API version the installed operator serves (v1beta1 vs older v1alpha1): oc api-resources --api-group=slinky.slurm.net.

container not found (slurmctld) or (slurmd) on oc exec

The pod is still in Init or crash-looping. Wait for 3/3 (controller) or 2/2 (worker), and check the real container names:

oc get pods -n slurm -l app.kubernetes.io/name=slurmctld
oc get pod slurm-worker-slinky-0 -n slurm -o jsonpath='{.spec.containers[*].name}'

If the controller is in CrashLoopBackOff, fix it first. Workers wait or fail until it is ready.

manifest unknown pulling images

The tag in your CR doesn’t exist. Fix it with oc edit controller slurm -n slurm (spec.slurmctld.image) and the NodeSet (spec.slurmd.image), keeping both on the same tag.

Unable to contact slurm controller (connect failure)

Workers reach the controller at slurm-controller.slurm:6817. Check the Service and DNS from a worker:

oc get svc -n slurm
oc exec -n slurm slurm-worker-slinky-0 -c slurmd -- getent hosts slurm-controller.slurm

Also check that no NetworkPolicy blocks port 6817. Once the controller is ready, restart the workers so they retry.

Insane message length

Version mismatch between slurmctld and slurmd, or a mismatched slurm.key. If the NodeSet sets no image, the operator’s default may differ from your controller’s. Compare the two:

oc get controller slurm -n slurm -o jsonpath='{.spec.slurmctld.image}'
oc get nodeset slurm-worker-slinky -n slurm -o jsonpath='{.spec.slurmd.image}'

Align the tags, then oc delete pod -n slurm -l app.kubernetes.io/name=slurmd and let the operator recreate the workers.

scontrol show job says the job ID is invalid

Finished jobs are purged from memory after MinJobAge (300 s by default). Raise it in extraConf, as in the Controller above, or enable accounting and use sacct.

Best Practices

  • Scope SCCs to the slurm namespace and its ServiceAccount only — never grant privileged cluster-wide
  • Start with anyuid, escalate to privileged only for login pods and GPU workers
  • Dedicated nodes — label and taint HPC nodes so OpenShift workloads and Slurm workers don’t contend
  • CephFS (RWX) for /home and datasets, shared by login and worker pods
  • Pin images and chart versions; upgrade operator → CRs/chart, never workers ahead of the controller

Key Takeaways

  • Slinky on OpenShift = upstream slurm-operator + SCC grants + auth secrets
  • anyuid is the floor (Slurm runs as UID 401); privileged unlocks login pods and GPUs
  • Install from OperatorHub and apply Controller/NodeSet CRs, or use the Helm pattern from redhat-hpc/slinky-on-openshift
  • Put NodeSet resources under spec.slurmd.resources
  • Next: add GPUs and autoscaling with Slurm GPU workloads on Kubernetes with Slinky
#slurm #slinky #openshift #scc #hpc #operators #batch-scheduling
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Cover of Kubernetes Recipes

Book by Grzegorz Stencel & Luca Berton · Apress

Kubernetes Recipes
Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens