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
Module Load (module load cuda)Docker Image (image: pytorch/pytorch:2.3.0-cuda12.1)Fully encapsulated runtime environment
Cluster Scratch (/global/scratch)PersistentVolumeClaim (CephFS/NVMe)Shared high-throughput scientific storage

  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.