kubernetes-retired / contrib

[EOL] This is a place for various components in the Kubernetes ecosystem that aren't part of the Kubernetes core.
Apache License 2.0
2.46k stars 1.68k forks source link

Nginx Ingress Controller problem with named targetPort in Service #781

Closed iSOcH closed 8 years ago

iSOcH commented 8 years ago

service.yaml:

apiVersion: v1
kind: Service
metadata:
  name: kibana-logging
  namespace: kube-system
  labels:
    k8s-app: kibana-logging
    kubernetes.io/cluster-service: "true"
    kubernetes.io/name: "Kibana"
spec:
  ports:
  - port: 5601
    protocol: TCP
    targetPort: 5601
  selector:
    k8s-app: kibana-logging

with ingress.yaml:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kibana-logging
  namespace: kube-system
spec:
  rules:
  - host: phive-logs.pmi.ag
    http:
      paths:
      - backend:
          serviceName: kibana-logging
          servicePort: 5601
        path: /

works flawlessly :)

but if i set targetPort: ui (as it is named in the pod definition) nginx ingress controller logs: service kube-system/kibana-logging does no have any active endpoints ... but:

$ kubectl get ep --namespace=kube-system kibana-logging
NAME             ENDPOINTS          AGE
kibana-logging   10.103.11.3:5601   4h
aledbf commented 8 years ago

@iSOcH it is a bug. Explanation: the NGINX Ingress controller uses the endpoints not the services to route traffic to the containers. This introduces an error when the targetPort is a name because EndpointPort do not support named ports.

paralin commented 8 years ago

Soo duplicate of #743?

aledbf commented 8 years ago

@paralin yes