我的规则应该是什么样子的: 如果要支持到服务的动态 URL 映射
/a should map to service service-a
/b should map to service service-b
/cccc should map to service service-cccc
注意:服务可以动态添加
因此,我们说10分钟。
/dddd should map to service service-dddd
基本上,您不断将新路径附加到 $.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