Traefik Ingress Stripprefix
使用Traefik作为入口控制器,并寻找一种剥离前缀的方法。由于这些前缀的路径部分将“转发”到服务上,除非服务也在同一路径上聆听,那么该服务将达到404。在文档中,如何删除转发路径,是否很清楚,有没有指针?
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: azure-vote-route
namespace: azure-vote
spec:
rules:
- host: <>.<>.cloudapp.azure.com
http:
paths:
# - path: /
# pathType: Prefix
# backend:
# service:
# name: azure-vote-front
# port:
# number: 80
- path: /foo
pathType: Prefix
backend:
service:
name: azure-vote-front
port:
number: 80
Using traefik as the ingress controller and looking for a way to stripping path prefixing. as these prefixed path section is "forwarded" to the service unless the service is also listening on a same path, the service will hit a 404. it was not very clear on the docs how to remove the forwarded paths, any pointers?
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: azure-vote-route
namespace: azure-vote
spec:
rules:
- host: <>.<>.cloudapp.azure.com
http:
paths:
# - path: /
# pathType: Prefix
# backend:
# service:
# name: azure-vote-front
# port:
# number: 80
- path: /foo
pathType: Prefix
backend:
service:
name: azure-vote-front
port:
number: 80
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到答案
选项1
善良:入口
并使用Traefik的中间件剥离前缀。并且使用入学定义上的注释来驳斥此中间件
&lt; Middlewear的命名空间&gt; - &lt; Middlewear的名称&gt;
eg
选项2
类型:IngressRoute(这是Traefik特定的入口实现。)
found the answers
option 1
kind: Ingress
and using a Middleware from traefik to strip the prefix. and this middleware is refereed using an annotation on the Ingress definition
<namespace-of-middlewear>-<name-of-middlewear>
eg
option 2
kind: IngressRoute (which is a traefik specific ingress implementation.)