When would you choose serverless functions over containers on Kubernetes for a new service?
Short answer
Choose serverless for event-driven, spiky or low-volume workloads where scale-to-zero, minimal operations and per-use billing matter. Choose containers for steady high throughput, long-running or latency-critical workloads, special runtime needs, or when Kubernetes is the organization's standard platform.
Detailed answer
| Factor | Serverless (Lambda, Functions, Cloud Run functions) | Containers (EKS/AKS/GKE, Cloud Run, Container Apps) |
|---|---|---|
| Traffic | Spiky, unpredictable, low average | Steady, high |
| Duration | Short (Lambda max 15 min) | Any |
| Cold start tolerance | Acceptable or mitigated | Avoided |
| Ops effort | Minimal | Higher (unless serverless containers) |
| Cost | Cheap at low utilization | Cheaper at high utilization |
| Portability | Provider-specific | Portable |
Serverless containers (Cloud Run, Container Apps, Fargate) are a middle ground.
What the interviewer expects
Criteria-based reasoning, awareness of limits and cost crossover.
Common mistakes to avoid
Dogmatic answers; ignoring cold starts or concurrency limits.