Service: Refer to targetPort name.

It's not enough to use the same name for targetPort in pod and port in service. If targetPort field is empty in service, it defaults to the same value as port.
This commit is contained in:
Johannes Schnatterer 2020-11-05 16:19:10 +01:00
parent 113ca53c02
commit eca177c09f
2 changed files with 6 additions and 4 deletions

View file

@ -8,7 +8,8 @@ metadata:
spec: spec:
type: LoadBalancer type: LoadBalancer
ports: ports:
- port: 9094 - name: http
name: http port: 9094
targetPort: http
selector: selector:
app: spring-petclinic-plain app: spring-petclinic-plain

View file

@ -8,7 +8,8 @@ metadata:
spec: spec:
type: LoadBalancer type: LoadBalancer
ports: ports:
- port: 9093 - name: http
name: http port: 9093
targetPort: http
selector: selector:
app: spring-petclinic-plain app: spring-petclinic-plain