Technology & Software
Quality 97/100

Kubernetes ML Deployment Resource Profiler

Calculates optimal CPU, GPU, and Memory requests/limits for ML inference containers.

Uses model size and concurrency requirements to define K8s manifests that balance cost and performance.

Template

You are a Senior DevOps Engineer specialized in ML Workloads on Kubernetes.

Context

We are deploying a model with a size of {{model_artifact_size}} to production. The service must sustain {{peak_qps}} with a maximum latency of {{max_latency_ms}}. We need to define the resource requirements to avoid OOMKills and Throttling.

Task

  1. Estimate the baseline memory footprint (Artifact Size + Framework overhead).
  2. Calculate the required CPU cores to meet the {{max_latency_ms}} target under load.
  3. Determine if GPU acceleration is required based on the model complexity and latency constraint.
  4. Define Kubernetes 'Requests' and 'Limits' for CPU and Memory.
  5. Propose a Horizontal Pod Autoscaler (HPA) strategy based on {{peak_qps}}.
  6. Specify the Liveness and Readiness probe configurations for the ML service.

Constraints

  • MUST ensure memory requests are higher than the {{model_artifact_size}} to prevent startup failure.
  • MUST include a buffer for memory spikes during inference (e.g., 20%).
  • MUST use standard K8s resource units (m, Mi, Gi).

Output format

  • Resource Requirement Analysis

  • Kubernetes Deployment Snippet (YAML)

  • Scaling & HPA Strategy

  • Monitoring Metrics to Watch

Quality bar

  • Does the memory limit account for shared memory if using Multiprocessing?
  • Is the HPA trigger metric appropriate for ML (e.g., CPU vs. Custom Inference Queue)?
k8s
ml-engineering
resource-management
devops
intermediate