ingress points to wrong port on a service
From what I see you don't have a Selector
field in your service. Without it, it will not forward to any backend or pod. What makes you think that it's going to port 8888
? What's strange is that you have Endpoints
in your service. Did you manually create them?
The service would have to be something like this:
Name: m-svcNamespace: m-nsLabels: Annotations: <none>Selector: app=my-applicationType: ClusterIPIP: 10.233.43.40Port: first 8080/TCPTargetPort: 8080/TCPEndpoints: 10.233.115.178:8080,10.233.122.166:8080Port: second 8888/TCPTargetPort: 8888/TCPEndpoints: 10.233.115.178:8888,10.233.122.166:8888Session Affinity: NoneEvents: <none>
Then in your deployment definition:
selector: matchLabels: app: my-application
Or in a pod:
apiVersion: v1kind: Podmetadata: annotations: { ... } labels: app: my-application
You should also be able to describe your Endpoints
:
$ kubectl describe endpoints m-svcName: m-svcNamespace: defaultLabels: app=my-applicationAnnotations: <none>Subsets: Addresses: x.x.x.x NotReadyAddresses: <none> Ports: Name Port Protocol ---- ---- -------- first 8080 TCP second 8081 TCPEvents: <none>
Your Service
appears to be what is called a headless service: https://kubernetes.io/docs/concepts/services-networking/service/#headless-services. This would explain why the Endpoints
was created automatically.
Something is amiss because it should be impossible for your HTTP request to arrive at you pods without the .spec.selector
populated.
I suggest deleting the Service
you created and delete the Endpoints
with the same name and then recreate the Service
with type=ClusterIP
and the spec.selector
properly populated.