【发布时间】:2018-07-03 13:54:16
【问题描述】:
我遇到了一个配置问题!我在 kubernetes 中使用 traefik 作为入口控制器,并且我有一个入口来路由一些 URL,以将一些前端路由到各种后端。假设我有这样的事情:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test
annotations:
kubernetes.io/ingress.class: traefik
traefik.frontend.rule.type: ReplacePathRegex
spec:
rules:
- host: foo.io
http:
paths:
- path: /api/authservice/(.*) /$1
backend:
serviceName: auth
servicePort: 8901
- path: /api/svcXXX/v1/files/cover/(.*) /v1/files/cover/$1
backend:
serviceName: files
servicePort: 8183
- path: /api/svcXXX/v1/files/image/(.*) /v1/files/image/$1
backend:
serviceName: files
servicePort: 8183
使用 Postman(或任何其他客户端),如果我在 http://foo.io/api/authservice/auth/oauth/token 上发布请求,同时查看访问日志,它似乎被路由到 http://foo.io/api/svcXXX/v1/files/image/(.*) /v1/files/image/$1。我在访问日志中看到了这一点:
[03/Jul/2018:12:57:17 +0000] "POST /api/authservice/auth/oauth/token HTTP/1.1" 401 102 "-" "PostmanRuntime/7.1.5" 15 "foo.io/api/svcXXX/v1/files/image/(.*) /v1/files/image/$1" 37ms
我是不是做错了什么?
【问题讨论】:
标签: kubernetes traefik kubernetes-ingress traefik-ingress