简体   繁体   English

Traefik入口在AWS负载均衡器后面不起作用

[英]Traefik ingress is not working behind aws load balancer

After I created a traefik daemonset, I created a service as loadbalancer on port 80, which is the Traefik proxy port and the node got automatically registered to it. 创建traefik守护程序集后,我在端口80(即Traefik代理端口)上创建了一个服务作为负载平衡器,并且节点自动注册到该端口。 If i hit the elb i get the proxy 404 which is OK because no service is registered yet 如果我碰到了弯头,我会得到代理404,这是可以的,因为尚未注册任何服务

I then created a nodeport service for the web-ui. 然后,我为web-ui创建了一个nodeport服务。 targeted port 8080 inside the pod and 80 on clusterip. 定位到Pod内的8080端口和clusterip上的80端口。 I can curl the traefik ui from inside the cluster and it retruns traefik UI 我可以从集群内部卷曲traefik ui,它重新运行traefik UI

I then created an ingress so that when i hit elb/ui it gets me to the backend web-ui service of traefik and it fails. 然后,我创建了一个入口,以便当我按下elb / ui时,它会将我带到traefik的后端Web-ui服务,但失败了。 I also have the right annotations in my ingress but the elb does not route the path to the traefik ui in the backend which is running properly 我在入口中也具有正确的注释,但是elb不会将路径路由到后端的traefik ui,该ui运行正常

What am i doing wrong here? 我在这里做错了什么? I can post all my yml files if required 如果需要,我可以发布所有yml文件

UPD UPD

My yaml files: 我的Yaml文件:

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: traefik
  labels:
    app: traefik
spec:
  template:
    metadata:
      labels:
        app: traefik
    spec:
      containers:
      - image: traefik
        name: traefik
        args:
        - --api
        - --kubernetes
        - --logLevel=INFO
        - --web
        ports:
        - containerPort: 8080
          name: traefikweb
        - containerPort: 80
          name: traefikproxy


apiVersion: v1
kind: Service
metadata:
  name: traefik-proxy
spec:
  selector:
    app: traefik
  ports:
  - port: 80
    targetPort: traefikproxy
  type: LoadBalancer


apiVersion: v1
kind: Service
metadata:
  name: traefik-web-ui
spec:
  selector:
    app: traefik
  ports:
  - name: http
    targetPort: 8080
    nodePort: 30001
    port: 80
  type: NodePort


apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  namespace: default
  name: traefik-ing
  annotations:
    kubernetes.io/ingress.class: traefik
    #traefik.ingress.kubernetes.io/rule-type: PathPrefixStrip:/ui
spec:
  rules:
  - http:
      paths:
      - path: /ui
        backend:
          serviceName: traefik-web-ui
          servicePort: 80

I then created an ingress so that when i hit elb/ui it gets me to the backend web-ui service of traefik and it fails." 然后,我创建了一个入口,这样当我点击elb / ui时,它会带我到traefik的后端Web-ui服务,并且失败。

How did it fail? 它是怎么失败的? Did you get error 404, error 500, or something else? 您收到错误404,错误500或其他信息吗?

Also, for traefik-web-ui service, you don't need to set type: NodePort , it should be type: ClusterIP . 另外,对于traefik-web-ui服务,您不需要设置type: NodePort ,它应该是type: ClusterIP

When you configure backends for your Ingress , the only requirement is availability from inside a cluster, so ClusterIP type will be more than enough for that. 当您为Ingress配置后端时,唯一的要求就是从群集内部获得可用性,因此ClusterIP类型将绰绰有余。

Your service should be like that: 您的服务应为:

apiVersion: v1
kind: Service
metadata:
  name: traefik-web-ui
spec:
  selector:
    app: traefik
  ports:
  - name: http
    targetPort: 8080
    port: 80

Option PathPrefixStrip can be useful because without it request will be forwarded to UI with /ui prefix, which you definitely don't want. 选项PathPrefixStrip很有用,因为没有它,请求将被转发到带有/ui前缀的UI,这是您绝对不希望的。

All other configs look good. 所有其他配置看起来不错。

If you are on Private_Subnets use 如果您在Private_Subnets上使用

kind: Service
metadata:
  name: traefik-proxy
> annotations:
>     "service.beta.kubernetes.io/aws-load-balancer-internal": "0.0.0.0/0"
spec:
  selector:
    app: traefik
  ports:
  - port: 80
    targetPort: traefikproxy
  type: LoadBalancer``` 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有现有 AWS HTTPS 负载均衡器的 K3S Kubernetes 集群中 Traefik Ingress Controller 的 AWS 证书解析器 - AWS certificate resolver for Traefik Ingress Controller in K3S Kubernetes Cluster with existing AWS HTTPS Load Balancer 无法使用 Traefik Ingress Controller 和 AWS HTTPS 负载均衡器在 AWS 上公开 Keycloak 服务器 - Can't expose Keycloak Server on AWS with Traefik Ingress Controller and AWS HTTPS Load Balancer AWS Elastic Load Balancer (ELB) 后面的 Windows 身份验证不起作用 - Windows Authentication behind AWS Elastic Load Balancer (ELB) not working AWS上的RabbitMQ MochiWeb在负载均衡器之后 - RabbitMQ MochiWeb on AWS behind Load Balancer 检测AWS Server是否在负载均衡器之后 - Detect if AWS Server is behind a Load Balancer or not AWS负载均衡器后面的SSL证书 - SSL certificate behind AWS Load Balancer AWS负载平衡器背后的Wordpress多站点 - Wordpress multisite behind an AWS load balancer AWS 应用程序负载均衡器背后的 wordpress 网站 - wordpress website behind AWS Application load balancer AWS Application Load Balancer无法正常工作 - AWS Application Load Balancer not working 负载均衡器上的入口 IP 白名单 - aws k8s - Ingress ip whitelisting on load balancer - aws k8s
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM