kubernetes: Services allow duplicate targetPort
It is possible to express a Service where multiple front-side ports target the same back-side port. This is not very useful and may cause trouble for implementations of Services.
apiVersion: v1
kind: Service
metadata:
name: hostnames-2
spec:
ports:
- name: a
port: 80
targetPort: 9376
- name: b
port: 81
targetPort: 9376
selector:
run: hostnames
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (15 by maintainers)
@thockin what problems did this cause with services? This change broke backwards compatibility for services that depended on this feature.
For example, lets take the load balancer service
The load balancer here terminates SSL so the backend is always port 80; however, you want to make sure you support both protocols so having the same targetPort here is a valid use case.
I think that should probably be rejected at validation unless we have a good reason WHY we need that.
On Thu, Jun 8, 2017 at 11:21 PM, Emmanuel T Odeke notifications@github.com wrote:
This is not an abuse of Service, but a quite common and wide-adopted pattern, especially in the AWS world.
FYI: the revert PR is https://github.com/kubernetes/kubernetes/pull/53576.