一、相同点
- 1、与IngressRoute不同命名空间的service依然不能为其查询后端服务
二、差异点
- 1、traefik 2.0取消
annotations
方式进行路径路由
annotations:
traefik.frontend.rule.type:pathprefixstrip
- 2、traefik 2.0在没有定义中间件
Middleware
,而直接使用match.PathPrefix()
是不能直接提供路径路由功能的
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: stripprefix
namespace: foo
spec:
stripPrefix:
prefixes:
- /stripit
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: ingressroutebar
spec:
entryPoints:
- web
routes:
- match: Host(`bar.com`) && PathPrefix(`/stripit`)
kind: Rule
services:
- name: whoami
port: 80
middlewares:
- name: stripprefix
namespace: foo