Curated summary
Scaling Kubernetes to 7,500 nodes
Scaling Kubernetes to 7,500 Nodes for Large-Scale ML Research
OpenAI scaled a single Kubernetes cluster to 7,500 nodes to support large model training such as GPT-3, CLIP, and DALL·E, as well as rapid small-scale research experiments. The key outcome is an infrastructure simple enough that research teams can scale their jobs without changing their code. The post covers the lessons learned since their earlier 2,500-node milestone and the problems that remain open.
Workload Characteristics
The workload differs from typical enterprise Kubernetes use, which shapes the solutions:
- Large ML jobs typically occupy entire nodes to use NVLink and GPUDirect, so NUMA, CPU, and bin-packing concerns are minimal and scheduler load is relatively low, though it is spiky when hundreds of pods are created at once.
- Large MPI jobs halt if any pod dies, so pods are treated as semi-stateful and disruption is kept to a minimum.
- Pods communicate directly by pod IP rather than through Services, and service discovery is a one-time lookup at job startup.
- Most data flows through blob storage, with PersistentVolumes used only where POSIX semantics are needed.
Networking
- Flannel could not keep up with the required throughput, so the team moved to native pod networking with Azure VMSS IP configurations and alias-based IPs, giving pods host-level network throughput.
- Clusters may use around 200,000 IPs at once, and route-based pod networking hit significant route-count limits.
- Avoiding encapsulation keeps VPN integration, network policy, and traffic monitoring simple, and avoids MTU-related fragmentation.
- iptables mangle rules tag traffic as internet-in or internet-out, and the open-source iptables-exporter feeds per-namespace counters into Prometheus so researchers can see their usage.
- The architecture is hub-and-spoke: researchers reach each cluster through a hub, but clusters cannot talk to each other, which preserves failure isolation. A NAT host translates the service CIDR for external traffic.
API Server and etcd
- API servers and etcd run on dedicated nodes, with 5 API servers and 5 etcd nodes in the largest clusters. API servers use up to about 70GB of heap each at 7,500 nodes.
- Splitting Kubernetes Events into their own etcd cluster eliminated notable etcd trouble.
- Endpoint WATCHes on node-wide services like kubelet created O(N²) traffic, sometimes reaching 1GB/s. EndpointSlices, introduced in Kubernetes 1.17, reduced this load by about 1000x.
- The team avoids DaemonSets that talk to the API server, and uses intermediary caching (such as the Datadog Cluster Agent) where per-node watches are necessary.
- Autoscaling hundreds of nodes at once can overload API servers, so smoothing scale-up by even a few seconds helped avoid outages.
Metrics with Prometheus and Grafana
- The team started from kube-prometheus and added custom dashboards and alerts, dropping overly granular metrics through Prometheus rules.
- Prometheus OOMs were traced to Grafana calling
/api/v1/serieswith{le!=""}. That endpoint was unbounded in time and memory, and kept consuming resources after clients disconnected. A patch adding a context timeout resolved it. - WAL replay after restarts took hours. Setting
GOMAXPROCS=24greatly improved replay, since contention across many cores had been the bottleneck.
Health Checks
Passive checks run continuously on every node and cover network reachability, disks, and GPU errors. GPU errors are monitored through DCGM and the DCGM_FI_DEV_XID_ERRORS metric, which records the most recent Xid error. Failing nodes are cordoned, then pods are evicted (respecting Pod Disruption Budgets), and the VM is forcibly terminated after 7 days, which is part of the SLA. Cloud maintenance events are also tracked.
Active GPU tests exercise hardware beyond what DCGM reports, and need exclusive GPU access for seconds to minutes:
- "Preflight" tests run at boot. Nodes join with a taint and label that block normal pods until the tests pass and remove them.
- Periodic tests run as a CronJob on arbitrary nodes. This coverage is less controlled but sufficient over time.
Quotas and Resource Sharing
- Team taints: A
team-resource-managerservice reconciles a ConfigMap of team allocations and taints nodes withopenai.com/team=teamname:NoSchedule. An admission webhook adds matching tolerations to jobs. Lower-priority pods can tolerate any team's taint, so teams can borrow idle capacity. - Balloons: Cluster-autoscaler sets min size to zero to remediate unhealthy nodes, but it scales down idle nodes, which is costly. Low-priority "balloon" Deployments occupy each node so it isn't considered idle, and are evicted immediately when real work arrives. A Deployment is used rather than a DaemonSet, and pod anti-affinity spreads the balloons evenly. The O(N²) anti-affinity scheduler issue was fixed in Kubernetes 1.18.
- Gang scheduling: Optimizer StatefulSets need all members scheduled together, or experiments can deadlock with partial allocations. The team adopted the Coscheduling plugin, enabled by the scheduler plugin architecture introduced in Kubernetes 1.18.
Open Problems
- Metrics storage: Prometheus's TSDB is slow to compact, has long WAL replays, and hits "too many samples" query errors. The team is migrating to a Prometheus-compatible storage and query engine.
- Traffic shaping: Researchers' aggregate internet bandwidth has grown large enough to strain external resources such as dataset hosts and package mirrors, and per-pod bandwidth limits are not enough to prevent this.
Conclusion
OpenAI found Kubernetes flexible enough to handle demanding ML workloads at 7,500 nodes, though it still needs improvement in areas like metrics and network shaping. The team plans to keep working on how Kubernetes scales.
Related reading
Continue with another curated summary.
OpenAI2018-01-17 Scaling Kubernetes to 2,500 nodes
Read original
OpenAI2016-08-28 Infrastructure for deep learning
Read original
GitLab2026-04-28 How to build CI/CD observability at scale
Read original
LINE2026-03-31 Applying Spark on Kubernetes to process large-scale advertising data for LINE services
Read original