[英]nginx ingress on kubernetes url routing to host
How should my rule look like : if want to support dynamic url mapping to services我的规则应该如何:如果要支持到服务的动态 url 映射
/a should map to service service-a
/b should map to service service-b
/cccc should map to service service-cccc
Note : services can be added dynamically注意:服务可以动态添加
hence afte r say 10 minutes.因此在说 10 分钟之后。 we now have
我们现在有
/dddd should map to service service-dddd
Basically you keep appending new path to $.spec.rules[x].http.paths, where x is the index of the host which you intend to add path on.基本上,您不断将新路径附加到 $.spec.rules[x].http.paths,其中 x 是您打算在其上添加路径的主机的索引。
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
namespace: my-namespace
annotations:
kubernetes.io/ingress.class: "nginx"
# and other annotations you need..
#labels:
# if you need labels
spec:
rules:
- host: "your.hostname"
http:
paths:
- path: /a
backend:
serviceName: service-a
servicePort: 443 # say your service runs on 443
- path: /b
backend:
serviceName: service-b
servicePort: 443 # say your service runs on 443
- path: /cccc
backend:
serviceName: service-cccc
servicePort: 443 # say your service runs on 443
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.