Traefik ingress does not work with cluster IP

蹲街弑〆低调 提交于 2019-12-11 05:45:55

问题


I am using minikube for developing an application on Kubernetes and I am using Traefik as the ingress controller.

I am able to connect and use my application services when I use the url of the host which I defined in the ingress ("streambridge.local") and I set up in the linux hosts ("/etc/hosts"). But when I use the exact same ip address that I used for the dns I am not able to connect to any of the services and I receive "404 page not found". I have to mention that I am using the IP address of the minikube which I got by: $(minikube ip). Below is my ingress config and the commnads that I used for the dns.

How I can connect and use my application services with the IP?

Ingress config:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: "traefik"
    traefik.frontend.rule.type: PathPrefixStrip
    traefik.frontend.passHostHeader: "true"
    traefik.backend.loadbalancer.sticky: "true"
    traefik.wss.protocol: http
    traefik.wss.protocol: https
spec:
  rules:
  - host: streambridge.local
    http:
      paths:
      - path: /dashboard
        backend:
          serviceName: dashboard
          servicePort: 9009
      - path: /rdb
        backend:
          serviceName: rethinkdb
          servicePort: 8085

My /etc/hosts:

127.0.0.1   localhost

192.168.99.100 traefik-ui.minikube
192.168.99.100 streambridge.local

This works: http://streambridge.local/rdb

But this does not work: http://192.168.99.100/rdb and returns 404 page not found


回答1:


You have created ingress routes that evaluate the host header of the http request. So while you are actually connecting to the same ip, it is once with host:streambridge.local and once with "192.168.99.100" for which you did not add a rule in traefik. This is therefore working exactly as configured.



来源:https://stackoverflow.com/questions/56152780/traefik-ingress-does-not-work-with-cluster-ip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!