[英]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.