Skip to content

Introduction to Kubernetes for HPC

If you have experience submitting Slurm batch scripts (sbatch, srun, squeue) on cluster systems, this guide provides a direct conceptual mapping to Kubernetes (kubectl, Pods, Jobs).

Slurm ConceptKubernetes EquivalentPurpose
sbatch job.shkubectl apply -f job.yamlSubmits a batch computation to the scheduler
squeue -u $USERkubectl get pods -n <namespace>Checks the status of active and queued tasks
scancel <jobid>kubectl delete job <job-name>Cancels and terminates running execution
#SBATCH --gpus=2resources.limits: {"nvidia.com/gpu": 2}Requests hardware GPU accelerators
#SBATCH --mem=64Gresources.limits: {memory: "64Gi"}Enforces RAM limits
Cluster Scratch (/global/scratch)PersistentVolumeClaim (ceph-rbd / cephfs)Persistent block (ceph-rbd) or shared POSIX (cephfs) storage
Node Scratch (/tmp / /scratch)emptyDir (Local NVMe)Ultra-fast ephemeral node scratch (lost on pod restart)

  1. Complete Reproducibility: No missing shared libraries or conflicting Python virtualenvs. Everything is packaged in standard OCI containers.
  2. Instant Microservices: Host interactive Dash/Streamlit visualization portals, FastAPI model servers, and notebooks with automatic URL routing.
  3. Resilience & Auto-Healing: If a worker node suffers a hardware fault, Kubernetes automatically restarts your pod on a healthy node.
  4. Dynamic Elastic Scaling: Auto-scale Ray or Dask workers based on real-time task queue depth.