Backend service port ignored in traefik on kubernetes

1/10/2019

I run an app on K8s with a port mapping 30060:30600 with type LoadBalancer

Now I want to add traefik to my cluster as reverse proxy with following Ingress setup

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "myapp.fullname" . }}-ingress
  labels:
    # deployment labels
    app: {{ template "myapp.name" . }} # app name 
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name | quote }}
    heritage: {{ .Release.Service | quote }}
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: myapp.mybox.internal
    http:
      paths:
      - path: /myapp
        backend:
          serviceName: {{ template "myapp.fullname" . }} # service name 
          servicePort: 30060

My issue now is, that the port 30060 is ignored here.

==> v1beta1/Ingress
NAME           HOSTS                      ADDRESS  PORTS  AGE
myapp-ingress  myapp.mybox.internal       80       0s

The result is, that all requests fail.

If I change the service config from

    - targetPort: myapp-port 
      port: 30060
      nodePort: 30060

to

    - targetPort: myapp-port 
      port: 80
      nodePort: 30060

the service is reachable, but:

  • App is not reachable under "/myapp"
  • but App is reachable under "/" - and I have no idea why?!

So my questions are: - Why is it not possible to change the service port? - Why the application does not answer on the mapped path, but on the root path?

Thanks!

-- Ben
kubernetes
kubernetes-helm
traefik

0 Answers