
Slurm is an open-source job scheduler for High-Performance Computing (HPC) environments. It allocates resources, manages job queues, and orchestrates workloads across clusters, and it powers many of the world's largest supercomputers, offering scalability, flexibility, and support for complex batch workflows.
This guide explains how to deploy a Slurm cluster on Vultr Kubernetes Engine (VKE) using the Slinky Slurm Operator, a Kubernetes operator for Slurm that SchedMD maintains. It covers installing the operator, deploying a Slurm cluster with the controller persisting state to Vultr Block Storage, recording job accounting data in a MariaDB database, exposing controller metrics to Prometheus, and connecting to the cluster over SSH through its login node.
Before you begin, ensure you:
kubectl and helm installed on your machine.The Slurm Operator manages Slurm cluster resources through a set of Custom Resource Definitions (CRDs) and uses cert-manager to issue the certificate for its admission webhook.
Install cert-manager and its CRDs.
Install the Slurm Operator CRDs.
Install the Slurm Operator into the slinky namespace.
Verify the operator pods are running.
Your output should be similar to the one below:
The Slurm chart deploys the controller, worker nodes, login node, and REST API as a single Slurm cluster. By default, the controller persists its state to a Persistent Volume Claim (PVC) that uses the cluster's default storage class, so specify Vultr Block Storage explicitly to control which class it uses.
List the storage classes available on the cluster.
The output includes vultr-block-storage, the default Vultr Block Storage class for persistent volumes.
Install the Slurm cluster with a worker node set, a partition, and controller persistence on Vultr Block Storage.
Kubernetes typically does not delete Persistent Volumes when you delete their PVC, so remove unused PVs manually. Disabling controller persistence with --set 'controller.persistence.enabled=false' is only appropriate for testing, because it loses the cluster's state on every controller restart.
Verify the Slurm cluster pods are running.
Your output should be similar to the one below:
Slurm accounting records job history and resource usage in a MariaDB or MySQL-compatible database. Deploy a database using the community-edition MariaDB Operator, then point Slurm's accounting service at it.
Add the MariaDB Operator Helm repository.
Update the local Helm repository cache.
Install the MariaDB Operator CRDs.
Install the MariaDB Operator controller into the mariadb namespace.
Create a manifest file for the accounting database.
Add the following configuration:
Save and close the file.
username and database: The credentials and database name the Slurm accounting service connects with. Use these same values later to query the accounting database directly.storage: Requests a 16Gi PVC on Vultr Block Storage for the database. This example aligns with the Slurm chart's default accounting.storageConfig; update it if your database configuration differs.rootPasswordSecretKeyRef and passwordSecretKeyRef: Generates and stores the root and application passwords in Kubernetes Secrets automatically.Apply the manifest to create the database in the slurm namespace.
Verify the database is ready.
Verify the READY column shows True before continuing.
Enable accounting on the Slurm cluster.
The --reuse-values flag keeps the node set, partition, and storage class values you set during the initial install.
Verify the accounting pod is running.
Verify the slurm-accounting-0 pod shows a Running status.
The Slurm controller can expose metrics for Prometheus to scrape through a ServiceMonitor resource, which the kube-prometheus-stack chart's Prometheus Operator watches for automatically.
Add the Prometheus Community Helm repository.
Update the local Helm repository cache.
Install the kube-prometheus-stack chart and its CRDs into the prometheus namespace.
Enable Slurm controller metrics and the Prometheus service monitor.
Verify the service monitor was created.
The output displays a service monitor for the Slurm controller.
The Slurm chart's login node accepts SSH connections and gives you a shell from which to run Slurm client commands against the cluster. Authorize your own SSH public key on the login node rather than configuring an external identity service.
Enable the login node and authorize your SSH public key. Replace SSH-PUBLIC-KEY-PATH with the path to your own public key, such as ~/.ssh/id_ed25519.pub or ~/.ssh/id_rsa.pub.
Retrieve the load balancer IP address and port assigned to the login service.
VKE provisions a Vultr Load Balancer for the login service automatically. Allow a few minutes for VKE to assign an external IP address.
Verify both values were retrieved before continuing.
The output shows an IP address and port, for example 66.135.9.113:22. If SLURM_LOGIN_IP is empty, the load balancer has not finished provisioning; wait a few minutes and rerun the previous step.
Connect to the login node over SSH.
From the login node, check the partition and node status.
The output resembles the following:
Verify the worker node shows idle, not down or drain.
Run a command directly on a worker node.
The output shows the hostname of the worker node the job ran on, confirming the controller can schedule work:
Submit a batch job.
The output confirms the controller accepted the job:
List jobs in the queue.
The output shows the job in a running (R) or pending (PD) state:
Display accounting records for both jobs from the MariaDB database configured earlier.
The output includes the earlier srun job and the sbatch job submitted in the previous step:
The sleep 60 job still shows RUNNING immediately after submission; rerun sacct after a minute to see it change to COMPLETED.
The commands above submit a job inline with --wrap. A batch script defines the job's resource requests and commands in a single file, which is the standard way to submit repeatable work to Slurm.
From the login node, create the script.
--job-name: The name Slurm displays for this job in squeue and sacct.--output: The file Slurm writes the job's combined stdout and stderr to, relative to the worker node's own filesystem.--ntasks: The number of tasks the job requests. This example requests one.--time: The job's time limit, after which Slurm cancels it.Submit the script to the queue.
The output confirms the controller accepted the job:
The example.out file is written on the node the job is scheduled to, not the login node.
Wait for the job to complete, then verify it succeeded from the login node using sacct.
The output confirms the job ran to completion with a zero exit code:
You have deployed a Slurm cluster on Vultr Kubernetes Engine using the Slinky Slurm Operator, with the controller persisting state to Vultr Block Storage, job accounting recorded in a MariaDB database, controller metrics exposed to Prometheus, and SSH access through the login node. From here, submit your own batch jobs with sbatch, add worker capacity by adjusting the nodesets value on the Slurm chart, or define additional partitions to separate workloads by hardware or priority. For more information, visit the Slinky documentation or the Slurm documentation.
0 Comments
Be the first to comment and share your perspective with the community.