# An overlay sets replicas for a Deployment that a HorizontalPodAutoscaler scales. What happens on each kubectl apply -k?

Kustomize, Hard (Expert), Troubleshooting. https://k8wiz.com/uquiz/an-overlay-sets-replicas-for-a-deployment-that-a-horizontalpodautoscaler-scales-what-happens-on-each-kubectl-apply-k

- A. The HPA's minReplicas is updated to match the overlay
- B. Each apply resets spec.replicas to the overlay's value
- C. kubectl skips spec.replicas because an HPA exists
- D. The build fails because an HPA targets the Deployment

**Answer:** Each apply resets spec.replicas to the overlay's value

**Explanation:** Kustomize writes spec.replicas into the Deployment, and every apply sets it back to that number, which can remove Pods the HPA added. Leave replicas out of the manifests of autoscaled workloads and let the HPA own the field.
