does k8 service connected via deployment’s label or pod’s label?
I would assume the deployment label but we keep ours same-named anyway (as in your example) – would be a simple test though – change the name on one and see if the service barks at not being tied to anything or if the ports don’t get exposed.
Services select Pods, not Deployments, and it’s important to understand why.
Deployment is one of many possible “workload abstractions”. We also have ReplicaSets (which are used by deployments under the covers) and StatefulSets and MANY people build their own workload controllers. How would a Service know how to find and de-layer those? At the end of the day, those all create Pods - that is the layer where everything is the same, so that is where Services operate.
Thanks, @thockin ,
So I would assume regardless StatefulSets/Deployment all selecting the Pods label.