我的规则应如何显示: 如果要支持到服务的动态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
答案 0 :(得分:1)
基本上,您一直将新路径追加到$ .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