Why does changing a Deployment's selector fail, and how are Pods adopted by ReplicaSets?
AdvancedConceptPods & Workloads
Answer
spec.selector is immutable in apps/v1. A ReplicaSet adopts any Pod matching its selector that has no controller ownerReference, which is dangerous with overlapping selectors. The Deployment adds a pod-template-hash label to separate its ReplicaSets and avoid overlap.