1
Judoon 4 天前
ingress 不是本来就能根据 path 转发到不同的 service 吗?这是基本功能啊?
或者说,我没理解你的意思? |
![]() |
2
huangmingyou 4 天前
servicename 不写死。 根据 path 自动匹配。
|
![]() |
3
doublleft 4 天前
这样搞 鉴权 session cookie 流控之类的实现太麻烦,我单独做一个 nodejs(fastify)服务当作网关 转发流量,好控制一些。有什么需求也好实现
|
![]() |
4
ElmerZhang 4 天前
自己写一段 nginx 配置,然后用 annotation `nginx.ingress.kubernetes.io/server-snippet ` 设置上去。
配置可以参考 https://stackoverflow.com/questions/5743609/dynamic-proxy-pass-to-var-with-nginx-1-0 |
![]() |
5
huangmingyou 4 天前
@ElmerZhang k8s 社区那个 ingress-nginx 跑通了,nginx 社区那个 nginx-ingress 还不行
|
![]() |
6
huangmingyou 4 天前
nginx.ingress.kubernetes.io/server-snippet: |
location /health { rewrite /health/(.*) /actuator/health break; proxy_pass http://default-$1; } |
![]() |
7
huangmingyou 3 天前
---
# nginx-ingress 这样配置可以了 apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: mytest namespace: env-pro annotations: nginx.ingress.kubernetes.io/server-snippet: | location /hinfo4 { rewrite /hinfo4/(.*)/(.*) /actuator/$2 break; proxy_pass http://$1.env-pro.svc.cluster.local:8080; } spec: rules: - host: hinfo4.example.cn http: paths: - path: /myservice backend: serviceName: myservice servicePort: 8080 ~ |