I want to use traefik ingress to achieve the following functions just like nginx:
nginx config:
location she/admin/art/ {
proxy_pass http://172.18.214.174:801/admin/;
}
location he/admin/art/ {
proxy_pass http://172.18.214.174:801/admin/;
}
location my/admin/art/ {
proxy_pass http://172.18.214.174:801/admin/;
}
If I want to achieve this effect in the traefik ingress
I need to use annotations:
traefik.ingress.kubernetes.io/redirect-regex: ^http://www.hx.com/she/admin/art/(.*)
traefik.ingress.kubernetes.io/redirect-replacement: http://www.hx.com/admin/$1
Unfortunately, if I do this, I need to create three ingress just like a silly monkey
If I understand you correctly:
You can try to use path matching.
You can also try to use rewrite annotation.
If those would not help than you have to setup 3 different Ingress as it will not be a problem for one host.
Please let me know if that helped.