Ingress objects create Route objects with the wrong port
Issue
-
When you create an
Ingress
object in OpenShift Container Platform, then the generatedRoute
object has thetargetPort
of the Pod assigned, not the one of the Service (should behttp-default
):$ oc apply -f - << EOF apiVersion: v1 kind: Service metadata: name: app spec: ports: - name: http-default port: 8080 protocol: TCP targetPort: default selector: deployment: app EOF $ oc apply -f - << EOF apiVersion: extensions/v1beta1 kind: Ingress metadata: name: app spec: rules: - host: app.test.com http: paths: - backend: serviceName: app servicePort: http-default path: / EOF $ oc get route app-6dqpg -o yaml apiVersion: route.openshift.io/v1 kind: Route metadata: [...] spec: host: app.test.com path: / port: targetPort: default to: kind: Service name: app [...]
Environment
- Red Hat OpenShift Container Platform (OCP) 3.11
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.