Playbook · DGX Spark cluster
Kubernetes runs your services from description files on both Sparks and restarts them when they fail. This page uses K3s, a lighter Kubernetes.
This installs system services that run with full rights and change the Spark's network rules. On Sparks that already do real work, plan a time to do it and know how to remove it.
Checked on 26 November 2026 against: Kubernetes (v1.37) and K3s documentation and the NVIDIA Kubernetes device plugin (latest release then: v0.20.2). Of our cluster pages, this one most needs a hardware test. We have not yet run this playbook start to finish on our own hardware.
Watch, then follow
Decide, then configure. Before you install Kubernetes on two DGX Sparks, here's what to decide.
The AI stack. We start with the two machines at the bottom of the stack. Kubernetes manages containers across them.
Whole pods only. The scheduler picks one Spark for each whole pod. It doesn't split one process across both. It can't lend one pod processors from each.
One server, one agent. We use K3s. The first Spark is the server, which can run work too. The second is an agent. With one server, losing it means losing control of the cluster. Our advice: put the same K3s version on both.
Check the extras. K3s also installs a web router and a load balancer, which can open ports on your Sparks. If you don't need them, turn them off when you start the server.
Requests and limits. A request is what the scheduler counts, and what's kept for the container. A processor limit is a ceiling. Reaching it slows the container down. A memory limit can get a process killed when memory runs short.
Spreading rules. Each model pod asks for one GPU, so two can't share one Spark here. Other pods may land together. Add a spread rule if they mustn't. For model updates, we stop the old pods first, because there's no spare GPU.
Decide first. The page lists the settings and defaults. We haven't run this on hardware.
10 steps
Set up, check, stop. Now let's install it, check the GPUs, and learn how to remove it.
Install the server. Warning: this installs a system service that changes network rules. Pick a quiet time. Download the installer, and read it first. Then install the server, using the cluster link's address and interface.
Join the agent. Download and read the installer there too. Join with the server's address and token. Treat that token as a password. Keep the cluster ports closed to other networks.
Add the plugin. Check on both that K3s found the NVIDIA runtime. Then install NVIDIA's device plugin, so Kubernetes can give out each GPU.
Prove both work. Both nodes should be ready, on their cluster addresses. Each should offer one GPU. Run the test pod on each, and read its log.
Keep it inside. Add the model service, one copy on each Spark. Keep the service inside the cluster. Other service types can open ports. Wait until both pods are ready, and check where each one runs.
Uninstalling loses data. To stop just the model, scale it to zero. Stopping K3s leaves containers running. Its kill all script stops them. Warning: uninstalling deletes cluster data. Copy what you need first, then remove the agent before the server.
Check, then use. The written page has the commands, fixes and sources.
11 steps
Is this the one?
People who already use Kubernetes, or who run many services and want them described in files and restarted automatically.
Restarts failed containers, gives services stable names inside the cluster, and keeps track of which GPU is in use.
The most to learn and update. With one server node, losing it means losing control of the cluster; K3s's high-availability setup with its built-in database needs three or more server nodes. It does not split a model for you.
Compare all five in the cluster method chooser.
Before you start
Two DGX Sparks on the same current DGX OS, with the cable link set up and tested as in the cluster setup guide. In the commands, my-spark is the first Spark, spark-two the second, and USER your user name. Replace words in capitals with your own values. Nothing on this page has been run by us on hardware.
A Spark's GPU used by an ordinary Docker container is not counted by Kubernetes, so stop GPU containers you started outside it before you schedule GPU pods. You also need Helm on the first Spark.
Another route: the upstream tool kubeadm builds standard Kubernetes. It leaves more to you: a container runtime it can talk to (Docker alone needs an adapter), a pod network add-on, and the swap setting, because the kubelet by default will not start with swap on. We chose K3s here because it brings a runtime and pod network with it.
How it fits together
Decide first
Settings in the next four sections were checked on 27 November 2026 against the Kubernetes documentation (v1.37) and the K3s documentation. None of them has been run by us on DGX Spark hardware. The install steps below use the choices this table calls ours.
| Decision | Your choices | What to weigh |
|---|---|---|
| Which Kubernetes | K3s or kubeadm | This page uses K3s (our choice). See the other route. |
| Node roles | One server and one agent | The first Spark controls the cluster, and K3s says a server also runs workloads, so both GPUs can be used. Lose the server and you lose cluster control. Two nodes are not enough for K3s’s embedded high-availability setup. |
| K3s version | A channel or one exact version | The installer takes the stable channel unless you set INSTALL_K3S_CHANNEL or INSTALL_K3S_VERSION. Our advice: install the same exact version on both and write it down. |
| Network for the cluster | The cluster link or another network | This page uses the cable link for node and pod traffic. |
| K3s’s built-in web router and load balancer | Keep or turn off Traefik and ServiceLB | K3s installs both. Traefik uses ports 80 and 443, and ServiceLB opens a Service’s port on the nodes. If you do not need them, K3s says to start every server with --disable=traefik and --disable=servicelb. With ServiceLB off, a LoadBalancer Service stays pending but still gets a node port. |
| GPU runtime | Per pod, or default on a node | This page puts runtimeClassName: nvidia in each GPU pod. K3s also has --default-runtime to make a runtime the default. NVIDIA’s plugin README describes the NVIDIA runtime as the default, while K3s shows the per-pod way; we have run neither on a Spark. |
| How the model uses two Sparks | A copy on each, or one split model | A Deployment gives you copies. A split model needs another tool. |
| CPU and memory | Requests, limits or neither | See CPU and memory settings. |
| Placement | Let the scheduler choose, or give it rules | See spreading. |
Unless you turn them off, K3s installs services that can open ports on your Sparks’ network addresses. Decide before you install. K3s says --disable also removes a packaged component that is already deployed, so on a cluster in use, check that nothing depends on it first.
| Setting | Default | What it controls and when to change it |
|---|---|---|
--node-ip | Not set | The address the node advertises. We set each Spark’s cluster link address |
--flannel-iface | Not set | The interface the pod network uses instead of its usual one. We set the cluster interface |
--flannel-backend | vxlan | How pod traffic crosses between nodes. Keep the default unless you know why not. The ports needed change with it |
--bind-address | Every interface | The address K3s listens on. We have not tested narrowing it; block the ports from other networks |
--write-kubeconfig-mode | 600, owned by root | Who can read the admin file. Keep it: that file controls the whole cluster |
--node-name or K3S_NODE_NAME | The host name | Two nodes cannot have the same name |
K3S_URL, K3S_TOKEN | Not set | With a URL, the installer sets up an agent. The agent also needs the token |
Options can also go in /etc/rancher/k3s/config.yaml, as K3s’s configuration page shows. From the server options, the quick start and the requirements. K3s’s requirements page recommends turning off ufw and firewalld, or adding rules if you keep them. We do not advise turning a firewall off: if yours is on, keep it, and use that page to work out the rules. We have not tested any.
Automatic or not
Kubernetes places whole pods. It does not split one process, or one pod, across both Sparks. A pod’s containers are always placed together, on one node. CPU work moves to the second Spark only if your software runs as more than one pod, or coordinates over the network by itself.
| Job | Done by Kubernetes | What you or your software must do |
|---|---|---|
| Choosing a node | The scheduler drops nodes that cannot run the pod, scores the rest and picks one; ties are broken at random | State what the pod needs, and add rules if it must go somewhere in particular |
| Several copies | A Deployment keeps the number of pods you ask for (default 1) | Set replicas. Copies do not share one model’s memory |
| Spreading copies | The scheduler prefers to spread by default, but that is not a promise | Add a rule if two copies must not share a Spark |
| Requests to a service | A Service sends traffic to its ready pods | Use the Service name. Your program must cope with any pod answering |
| One program’s CPU work | Not split | Run it as several pods that each take part of the work, with your own way to divide it |
| CPU threads inside a pod | Not chosen for you by these settings | Set them with your software’s own options |
| A model too big for one Spark | Not split by a Deployment | Use software that splits models, and a tool that starts its pods together |
| Moving a running pod | A running pod is not moved to even things out | A replacement is a new pod, which is scheduled again |
| Model files and images | This page’s hostPath folder is that Spark’s own folder; Kubernetes does not copy it | Make the files available on each Spark |
CPU and memory
Each Spark has a 20-core processor and 128 GB of memory shared with the GPU. In Kubernetes, one CPU unit is one core on a physical machine, and 500m is half of one. Neither a request nor a limit chooses how many threads your program starts.
| Setting | What it controls | If you leave it out | When to change it |
|---|---|---|---|
| CPU request | What the scheduler counts, and the CPU kept for the container. It may use more if the node has some free | No CPU is reserved, unless a limit or a cluster default supplies a request | Set it to what the program needs to keep working when others are busy. Measure first |
| CPU limit | A hard ceiling, enforced by slowing the container (throttling) | No ceiling from this setting | When one pod must not take CPU others need. A low limit can slow data work |
| Memory request | What the scheduler counts for memory | Nothing reserved, unless a limit or a cluster default supplies it | From measured use |
| Memory limit | A ceiling the Linux kernel enforces by killing processes when it detects memory pressure | No ceiling from this setting | With care on a Spark, whose memory is shared with the GPU |
nvidia.com/gpu | GPUs for the container, in whole numbers, never overcommitted | The pod is not counted as using a GPU | Always set it, as a limit. If you also give a request, it must be the same |
The When to change it column is our advice.
If you give a limit and no request, and nothing else adds a default, Kubernetes copies the limit into the request. The scheduler places pods by what they request, and does not give out more than the node’s allocatable amount. To hold resources back for the operating system and Kubernetes, the kubelet has systemReserved and kubeReserved; we have not tested setting either on K3s.
We have not checked how memory the GPU uses is counted against a container’s memory limit on DGX Spark. Do not treat that limit as a cap on model memory.
To try requests and limits, add them beside the GPU line in chat.yaml. Replace every word in capitals with a value from your own measurements. We give none:
resources:
requests:
cpu: "CPU-REQUEST"
memory: MEMORY-REQUEST
limits:
cpu: "CPU-LIMIT"
memory: MEMORY-LIMIT
nvidia.com/gpu: 1
Applying a change to the pod description replaces the model pods. With Recreate, all of them stop first, so requests fail until the new ones are ready. A memory limit that is too low can get the model killed.
Kubernetes gives each pod a class. Guaranteed needs every container to have CPU and memory requests and limits, with each request equal to its limit. BestEffort has none. Most others are Burstable. When a node runs short, BestEffort pods are first in line to be evicted.
The kubelet’s CPU manager policy is none by default, so these containers are not pinned to their own cores. Its static policy gives whole cores only to containers in Guaranteed pods that request a whole number of CPUs, and needs some CPU reserved for the system. Changing it on a working node means draining the node, stopping the kubelet and removing its saved CPU state. We have not tried it with K3s and give no steps.
Our advice: set your software’s thread and worker options to suit the CPU you gave the pod, through its arguments or an env entry such as OMP_NUM_THREADS, if it reads one. Check what it really starts. For a training job, see PyTorch’s CPU settings.
The shm volume in this page’s example is held in memory. What it stores counts as the pod’s memory use. With no sizeLimit, it can grow to the pod’s memory limit, if that is set for every container or for the pod, and otherwise up to the node’s allocatable memory.
Placement
Two pods that each ask for a GPU cannot both fit on a Spark that offers one, so this page’s model pods end up one on each. Pods without a GPU request have no such guarantee. With no cluster settings of its own, the scheduler uses soft default spreading rules: for host names, a difference of up to 3 matching pods, and ScheduleAnyway.
| Rule | What it does | Watch for |
|---|---|---|
nodeSelector | Only nodes with all the listed labels | The pod waits if none match |
| Node affinity | A required rule, or a preference, about node labels | A preference can be ignored when no node matches |
| Pod anti-affinity | Keeps matching pods apart, for example by kubernetes.io/hostname | A required rule leaves extra pods pending |
| Topology spread | Limits the difference in matching pods between nodes with maxSkew. whenUnsatisfiable is DoNotSchedule by default; ScheduleAnyway makes it a preference | Rules apply when a pod is placed. Removing pods can leave them uneven |
nodeName | Names the node and bypasses the scheduler | The pod can fail if that node lacks room |
To ask for an even spread of the app: chat pods, this goes under the template’s spec, level with containers. We have not applied it on hardware:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels: {app: chat}
See also assigning pods to nodes.
| Setting | Default | What it means here |
|---|---|---|
strategy.type | RollingUpdate, with maxSurge and maxUnavailable 25% | With 2 replicas, those round to one extra pod and none unavailable. The extra pod would need a third GPU, so the update could not finish. We use Recreate, which stops all old pods first. By Kubernetes’s rules, maxSurge: 0 with maxUnavailable: 1 should instead update one at a time; we have not run it |
Startup probe periodSeconds, failureThreshold | 10 seconds; 3 failures (API source) | The defaults allow only about 30 seconds. The example’s 360 failures at 10 seconds allow about an hour. Set it from how long your model takes to load |
| Time before eviction from an unreachable or not-ready node | 300 seconds, added by Kubernetes | After about five minutes pods are marked for eviction. A replacement GPU pod has nowhere to go while the other Spark’s GPU is taken. If the lost Spark is the server, the cluster cannot make these decisions |
Applying a manifest that has replicas: 2 also undoes a replica count you changed earlier with kubectl scale.
Set up
curl -sfL https://get.k3s.io -o k3s-install.sh
less k3s-install.sh
--node-ip and --flannel-iface put the traffic between nodes and between pods on the cluster link.
This installs and starts a system service, and changes network rules.
sudo sh k3s-install.sh server \
--node-ip FIRST-SPARK-LINK-ADDRESS \
--flannel-iface LINK-INTERFACE
sudo k3s kubectl get nodes
Replace LINK-INTERFACE, here and on the second Spark, with the name of the cluster link interface that is up (for example enp1s0f1np1).
If you decided against Traefik or ServiceLB, add --disable=traefik or --disable=servicelb to this server command. If you chose an exact K3s version, set INSTALL_K3S_VERSION to it for the installer on both Sparks, inside the sudo command, for example sudo env INSTALL_K3S_VERSION=YOUR-VERSION sh k3s-install.sh server followed by the same options; for the agent, add it after sudo env in the next step.
The join token is in /var/lib/rancher/k3s/server/node-token on the first Spark; read it with sudo cat. On the second Spark:
Treat the token as a password. This also installs a system service.
read -rs K3S_TOKEN
sudo env K3S_URL=https://FIRST-SPARK-LINK-ADDRESS:6443 \
K3S_TOKEN="$K3S_TOKEN" \
sh k3s-install.sh --node-ip SECOND-SPARK-LINK-ADDRESS \
--flannel-iface LINK-INTERFACE
unset K3S_TOKEN
K3s lists TCP 6443 for the API, UDP 8472 for the default pod network between nodes, and TCP 10250 for the kubelet. K3s warns that port 8472 must never be open to others, because it gives access to the cluster network. By default the API listens on every interface, so check with sudo ss -lntup and block these from other networks. Never share the admin file /etc/rancher/k3s/k3s.yaml.
sudo grep nvidia /var/lib/rancher/k3s/agent/etc/containerd/config.toml
K3s adds it when it finds NVIDIA's runtime installed. If nothing prints, check the NVIDIA Container Toolkit and restart the K3s service (k3s on the first, k3s-agent on the second).
Restarting these services interrupts cluster management on that node.
Kubernetes needs a vendor device plugin before it can schedule GPUs. On the first Spark, add NVIDIA's Helm chart and see which versions exist:
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
sudo helm --kubeconfig "$KUBECONFIG" repo add nvdp \
https://nvidia.github.io/k8s-device-plugin
sudo helm --kubeconfig "$KUBECONFIG" repo update
sudo helm search repo nvdp --versions
sudo k3s kubectl label node my-spark spark-two nvidia.com/gpu.present=true
sudo helm --kubeconfig "$KUBECONFIG" upgrade -i nvdp \
nvdp/nvidia-device-plugin \
--namespace nvidia-device-plugin --create-namespace \
--version VERSION --set runtimeClassName=nvidia
Use your own node names as get nodes shows them. The label is one the chart accepts to force it onto a node, when no feature-detection add-on is installed.
Not yet proven by us: NVIDIA lists DGX Spark as a supported platform for its GPU Operator, a larger tool we do not set up here. We have not run the plugin with K3s on a Spark.
Check
sudo k3s kubectl get nodes -o wide
sudo k3s kubectl describe nodes | grep -i 'nvidia.com/gpu'
To see what the scheduler has to work with, and what pods have asked for:
sudo k3s kubectl describe node my-spark
sudo k3s kubectl describe node spark-two
Read Allocatable and Allocated resources. The second lists requests and limits, not what is being used now. After you add the model service, this shows each pod’s class:
sudo k3s kubectl get pods -l app=chat \
-o custom-columns=NAME:.metadata.name,NODE:.spec.nodeName,QOS:.status.qosClass
Success is two nodes marked Ready, with their cluster link addresses, and one nvidia.com/gpu on each. Then run a test pod. This one is adapted from the device plugin's README; save it as gpu-test.yaml:
apiVersion: v1
kind: Pod
metadata:
name: gpu-test
spec:
restartPolicy: Never
runtimeClassName: nvidia
containers:
- name: cuda
image: nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0
resources:
limits:
nvidia.com/gpu: 1
sudo k3s kubectl apply -f gpu-test.yaml
sudo k3s kubectl get pod gpu-test -o wide
sudo k3s kubectl logs gpu-test
sudo k3s kubectl delete pod gpu-test
The log should end with Test PASSED. We have not confirmed this sample image on a DGX Spark; if it will not run, read describe pod before blaming the setup. Add nodeName under spec to test each node in turn.
A model service
This is a copy on each Spark as Kubernetes objects. First store the API key, typed so it stays out of your shell history:
read -rs KEY
sudo k3s kubectl create secret generic chat-key \
--from-literal=api-key="$KEY"
unset KEY
Save as chat.yaml, replacing the capitals:
apiVersion: apps/v1
kind: Deployment
metadata:
name: chat
spec:
replicas: 2
strategy:
type: Recreate
selector:
matchLabels: {app: chat}
template:
metadata:
labels: {app: chat}
spec:
runtimeClassName: nvidia
containers:
- name: vllm
image: VLLM-IMAGE:TAG
command: ["vllm", "serve"]
args: ["ORG/MODEL"]
env:
- name: VLLM_API_KEY
valueFrom:
secretKeyRef: {name: chat-key, key: api-key}
ports:
- containerPort: 8000
resources:
limits:
nvidia.com/gpu: 1
startupProbe:
httpGet: {path: /health, port: 8000}
periodSeconds: 10
failureThreshold: 360
readinessProbe:
httpGet: {path: /health, port: 8000}
volumeMounts:
- {name: models, mountPath: /root/.cache/huggingface}
- {name: shm, mountPath: /dev/shm}
volumes:
- name: models
hostPath: {path: /home/USER/.cache/huggingface}
- name: shm
emptyDir: {medium: Memory}
---
apiVersion: v1
kind: Service
metadata:
name: chat-api
spec:
type: ClusterIP
selector: {app: chat}
ports:
- port: 8000
targetPort: 8000
sudo k3s kubectl apply -f chat.yaml
sudo k3s kubectl get pods -o wide -w
Expect one pod on each Spark to become ready. Recreate is used because there is no spare GPU for a replacement to start on during an update; it means updates have a gap. A hostPath folder gives the pod access to that folder on the Spark. A gated model also needs a token in a second secret. The vLLM Kubernetes page shows more options.
Leave the Service as ClusterIP. A NodePort or LoadBalancer service opens a port on the Sparks' network addresses.
For a quick test, forward a port to the Spark itself and tunnel to it. A port-forward goes to one pod, so it does not show the sharing; apps running inside the cluster use the Service name and are shared between the pods.
sudo k3s kubectl port-forward service/chat-api 8000:8000
A split model is a different job: two pods that must start and stop together. That takes a tool built for it: SGLang documents deploying on Kubernetes with LeaderWorkerSet, and vLLM points to KubeRay. You would also need the settings from the split-model page or the Ray page. Two replicas in a Deployment do not split anything. We give no split manifest because we have not verified one.
Stop and undo
To stop only the model, scale it to nothing; start it again with 2:
sudo k3s kubectl scale deployment chat --replicas=0
K3s says that stopping its service leaves containers running. Its kill-all script, /usr/local/bin/k3s-killall.sh, stops them all and keeps the cluster data. To stop a node's service as well: sudo systemctl stop k3s-agent on the second, sudo systemctl stop k3s on the first. They start again at the next boot unless disabled.
Uninstalling can lose data. K3s says its uninstall scripts delete the cluster's local database, local volume data, node settings and tools. Copy out what you need first.
To undo: delete your objects, remove the second node, then the first.
sudo k3s kubectl delete -f chat.yaml
sudo k3s kubectl delete secret chat-key
sudo k3s kubectl drain spark-two --ignore-daemonsets \
--delete-emptydir-data
# on the second Spark
sudo /usr/local/bin/k3s-agent-uninstall.sh
# on the first Spark
sudo k3s kubectl delete node spark-two
sudo /usr/local/bin/k3s-uninstall.sh
Check afterwards that your link and your other containers still work.
Problems
| What you see | What to try |
|---|---|
| The second node never appears | Check the token, and that port 6443 on the first Spark is reachable over the link. Read sudo journalctl -u k3s-agent. |
No nvidia.com/gpu on a node | Check the runtime line, the node label and the plugin pod's log. |
| Pod stays Pending | describe pod gives the reason. Each Spark has one GPU, so a third GPU pod waits. |
| Pod stays Pending and the reason says not enough CPU or memory | Compare its requests with what describe node shows as allocatable and already requested. |
| A pod is slow although the Spark looks idle | Check for a low CPU limit, and how many threads the software starts. |
| A container restarts and shows OOMKilled | Compare the memory limit with what the program needs, including the shared memory volume. |
| An update never finishes, with a new pod Pending | Check the update strategy: with one GPU on each Spark there is no spare for an extra pod. |
| Pods on different Sparks cannot talk | Check UDP 8472 between the two over the link and the interface name. |
More: cluster problems by symptom.
Next
Server AI Hub is our app for looking after a DGX Spark. You do not need it to follow this playbook. It is coming soon to the App Store and the Microsoft Store.
Sources
Read on 26 and 27 November 2026. These projects change often; if their pages differ from this one, follow them.
General guidance only, in our own words. Back up before you start; you use these steps at your own risk. NVIDIA, DGX, DGX Spark, ConnectX and CUDA are trademarks of NVIDIA Corporation; Kubernetes, K3s, Ray, PyTorch, vLLM, SGLang, NGINX, Docker and other names belong to their owners. 6ixLabs is not affiliated with or endorsed by NVIDIA or any of these projects.