Kubernetes for ML Model Deployment
Sep 01, 2026 4 Min Read 20 Views
(Last Updated)
Kubernetes ML deployment refers to using Kubernetes, an open-source container orchestration platform, to deploy, scale, and manage machine learning models in production. Kubernetes automates the scheduling, scaling, and self-healing of containerized ML serving workloads, making it the standard infrastructure layer for teams that need reliable, scalable model serving across cloud and on-premise environments.
Table of contents
- TL;DR Summary
- Core Kubernetes Concepts for ML Teams
- Deploying a Model Server on Kubernetes
- Core Deployment and Service Configuration
- Configuring GPU Workloads
- GPU Resource Configuration Reference
- Horizontal Pod Autoscaling for ML Workloads
- Scaling Behavior Reference
- ML-Specific Deployment Tools on Kubernetes
- Conclusion
- FAQ
- What is Kubernetes ML deployment?
- Do I need Kubernetes to deploy ML models in production?
- How do I run GPU workloads on Kubernetes?
- What is the difference between KServe and base Kubernetes for ML serving?
- How does Kubernetes handle model updates without downtime?
- What is dynamic batching and which Kubernetes ML tool supports it?
TL;DR Summary
- Kubernetes ML deployment uses container orchestration to run ML model serving workloads reliably at scale
- Models are packaged as Docker containers and deployed as Kubernetes Pods managed by Deployments or StatefulSets
- Kubernetes handles automatic scaling, load balancing, self-healing, and rolling updates without manual intervention
- GPU workloads require specific Kubernetes configuration including resource limits, node selectors, and GPU device plugins
Core Kubernetes Concepts for ML Teams
- Pods and Containers
A Pod is the smallest deployable unit in Kubernetes. It contains one or more containers that share network and storage. For ML serving, a Pod typically contains the model server container and optionally a sidecar container for logging or metrics collection.
Pods are ephemeral by design. They can be created, destroyed, and rescheduled onto different nodes at any time. This is why you rarely create Pods directly and instead use higher-level objects that manage them.
- Deployments
A Deployment manages a set of identical Pod replicas and ensures the desired number are always running. If a Pod crashes, the Deployment controller creates a replacement. If you update the container image, the Deployment performs a rolling update, gradually replacing old Pods with new ones while maintaining availability.
For stateless model servers that load the model from a shared storage location at startup, Deployments are the standard choice.
- Services
A Service provides a stable network endpoint for accessing a set of Pods. Because Pods are ephemeral and their IP addresses change when they restart, a Service provides a consistent IP and DNS name that routes traffic to whichever Pods are currently healthy.
For ML serving, a Service of type ClusterIP exposes the model server internally within the cluster. A LoadBalancer Service provisions an external load balancer to accept traffic from outside the cluster.
- ConfigMaps and Secrets
ConfigMaps store non-sensitive configuration that model serving containers need, such as model paths, feature preprocessing parameters, or serving thresholds. Secrets store sensitive values like API keys, database credentials, or cloud provider credentials needed to load models from object storage.
Both are injected into containers as environment variables or mounted as files, keeping configuration separate from the container image.
Want to build the MLOps and cloud infrastructure skills that production AI engineering roles demand? Explore HCL GUVI’s Artificial Intelligence & Machine Learning Course, designed to help you go from model training to production deployment with real-world tools and workflows.
Deploying a Model Server on Kubernetes
Here is a complete example deploying a FastAPI model server. The manifests below create a Deployment with two replicas and a Service to expose it.
Core Deployment and Service Configuration
| Object | Field | Value | Purpose |
| Deployment | replicas | 2 | Run two instances for availability |
| Deployment | image | your-registry/model-server:v1 | Container image with model code |
| Deployment | containerPort | 8080 | Port the server listens on |
| Deployment | resources.requests.memory | 2Gi | Minimum memory guaranteed |
| Deployment | resources.limits.memory | 4Gi | Maximum memory allowed |
| Deployment | livenessProbe path | /health | Endpoint Kubernetes checks for liveness |
| Deployment | readinessProbe path | /ready | Endpoint checked before routing traffic |
| Service | type | ClusterIP | Internal cluster access |
| Service | port | 80 | External port |
| Service | targetPort | 8080 | Container port to forward to |
The liveness probe tells Kubernetes whether the container is alive. If it fails, the container is restarted. The readiness probe tells Kubernetes whether the container is ready to receive traffic. A model server that is still loading a large model from disk should return a failing readiness check until the model is fully loaded, preventing traffic from hitting the server before it is ready to serve.
Read More: 10 Interesting Data Science Kubernetes Projects To Upskill Your Knowledge
Configuring GPU Workloads
Running GPU-based model inference on Kubernetes requires additional configuration beyond a standard CPU deployment.
First, the cluster nodes must have GPU hardware and the appropriate GPU device plugin installed. For NVIDIA GPUs, this is the NVIDIA Device Plugin, a DaemonSet that runs on every GPU node and exposes GPU resources to the Kubernetes scheduler.
Second, the model serving container must include the correct GPU drivers and CUDA libraries for the model framework being used, typically packaged in a base image from NVIDIA’s container registry.
Third, the Deployment spec must declare GPU resource requests and limits so the Kubernetes scheduler places the Pod on a node with available GPUs.
GPU Resource Configuration Reference
| Field | Example Value | Notes |
| resources.limits nvidia.com/gpu | 1 | Request 1 GPU per Pod |
| nodeSelector nvidia.com/gpu-model | A100 | Target specific GPU hardware |
| tolerations key | nvidia.com/gpu | Required to schedule on GPU nodes |
| runtimeClassName | nvidia | Use NVIDIA container runtime |
One important constraint: GPU requests and limits must be equal in Kubernetes. You cannot request 0.5 GPU. GPU resources are allocated as whole units per container.
For cost efficiency, multiple model servers can share GPU nodes if their GPU memory requirements allow. A node with 80GB of GPU memory can host several smaller models simultaneously, with Kubernetes managing scheduling to ensure GPU memory limits are respected.
Horizontal Pod Autoscaling for ML Workloads
Kubernetes Horizontal Pod Autoscaler (HPA) automatically scales the number of model server replicas based on observed metrics, handling traffic spikes without manual intervention.
Standard HPA scales on CPU utilization or memory. For ML serving, custom metrics are often more meaningful. Queue depth, inference latency, and requests per second directly reflect serving load in a way that CPU utilization does not, since GPU-based inference may keep CPUs lightly loaded while GPUs are fully saturated.
Custom metric scaling requires a metrics adapter that exposes application metrics from Prometheus or a cloud monitoring system to the Kubernetes HPA controller. Once configured, HPA automatically adds replicas when average latency exceeds a threshold and removes replicas during low-traffic periods.
Scaling Behavior Reference
| Parameter | Recommended Value | Purpose |
| minReplicas | 2 | Always maintain availability |
| maxReplicas | 20 | Cap to control costs |
| scaleUp stabilizationWindowSeconds | 60 | Wait before scaling up |
| scaleDown stabilizationWindowSeconds | 300 | Wait longer before scaling down |
| metric type | Pods or External | Use custom inference metrics |
The longer stabilization window for scale-down prevents thrashing where replicas are repeatedly added and removed during variable traffic patterns. Scale-up should be fast to maintain latency targets. Scale-down should be conservative to avoid removing capacity during brief traffic lulls.
Uber’s Michelangelo ML platform, which serves thousands of models across their ride-sharing, food delivery, and freight businesses, runs entirely on Kubernetes and processes hundreds of millions of predictions daily. Uber’s engineering blog documented that migrating to Kubernetes-based model serving reduced their average model deployment time from weeks to hours by standardizing the deployment pipeline across all teams and model types.
ML-Specific Deployment Tools on Kubernetes
Base Kubernetes handles container orchestration but does not understand ML-specific concerns like model versioning, A/B testing between model versions, or multi-framework serving. Several tools add this ML-aware layer on top of Kubernetes.
| Tool | Primary Use Case | Key Features |
| KServe | General model serving | Multi-framework, canary deployments, autoscaling |
| Seldon Core | Enterprise ML serving | A/B testing, explainability, drift detection |
| BentoML | Packaging and serving | Simple API, multi-framework, cloud agnostic |
| Triton Inference Server | High-performance GPU serving | Dynamic batching, model ensembles, TensorRT |
| Ray Serve | Distributed serving | Python-native, composable pipelines |
KServe, formerly KFServing, is the most widely adopted and provides a Kubernetes custom resource called InferenceService that abstracts away the Deployment, Service, and autoscaling configuration into a single declarative specification. Specifying a model URI and framework is often enough for KServe to generate the full serving infrastructure automatically.
Triton Inference Server is the preferred choice for maximum GPU utilization because it implements dynamic batching, grouping multiple inference requests together into a single GPU batch, significantly increasing throughput compared to processing requests individually.
Kubernetes was originally developed by Google based on their internal cluster management system called Borg, which Google had been using to manage its own production workloads since 2003. Google open-sourced Kubernetes in 2014 and donated it to the Cloud Native Computing Foundation in 2016, and it has since become the de facto standard for container orchestration used by the majority of Fortune 500 companies running production ML workloads.
Want to build the MLOps and cloud infrastructure skills that production AI engineering roles demand? Explore HCL GUVI’s Artificial Intelligence & Machine Learning Course, designed to help you go from model training to production deployment with real-world tools and workflows.
Conclusion
Kubernetes ML deployment has become the standard approach for production model serving because it addresses the core operational requirements of ML systems, reliability, scalability, and manageability, through a single orchestration platform that teams can operate consistently across cloud providers and on-premise environments.
The path from a single Flask model server to a production Kubernetes deployment involves understanding Pods, Deployments, Services, autoscaling, and GPU configuration. ML-specific tools like KServe and Triton reduce the configuration burden for common serving patterns.
FAQ
What is Kubernetes ML deployment?
It is the use of Kubernetes container orchestration to deploy, scale, and manage ML model serving workloads in production, providing automatic scaling, self-healing, and rolling updates for model serving containers.
Do I need Kubernetes to deploy ML models in production?
Not necessarily. Managed services like AWS SageMaker, Google Vertex AI, and Azure ML abstract away Kubernetes. But teams wanting infrastructure control, multi-cloud portability, or tight cost management typically choose Kubernetes directly.
How do I run GPU workloads on Kubernetes?
Install the NVIDIA Device Plugin DaemonSet on GPU nodes, use NVIDIA base container images, and declare nvidia.com/gpu resource limits in your Deployment spec. The Kubernetes scheduler places Pods on nodes with available GPU capacity.
What is the difference between KServe and base Kubernetes for ML serving?
Base Kubernetes requires manually configuring Deployments, Services, autoscaling, and ingress for each model. KServe provides an InferenceService custom resource that generates this infrastructure automatically from a model URI and framework specification.
How does Kubernetes handle model updates without downtime?
Rolling update strategy in Deployments gradually replaces old Pods with new ones, maintaining a minimum number of available replicas throughout. Traffic shifts progressively to new Pods as they pass readiness checks, with zero downtime if the new version is healthy.
What is dynamic batching and which Kubernetes ML tool supports it?
Dynamic batching groups multiple inference requests arriving within a time window into a single GPU batch, dramatically increasing throughput. NVIDIA Triton Inference Server implements dynamic batching and runs as a container on Kubernetes.



Did you enjoy this article?