入口路由到子域的不同k8s服务



我正在尝试创建一个路由到service1的入口当service1.domain.com输入&生成service2service2.domain.com输入。我的入口文件如下所示。我在Azure AKS和使用Azure应用网关作为我的入口控制器。下面是我的入口页面。

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
annotations: 
kubernetes.io/ingress.class: azure/application-gateway
spec:
rules:
- host: service1.domain.com
- http:
paths:
- path: /
backend:
service:
name: service1
port:
number: 80
pathType: Prefix      
- host: service2.domain.com
- http:
paths:
- path: /
backend:
service:
name: service2
port:
number: 80
pathType: Prefix

然而,两个域都被路由到service2。有人能帮我一下吗?

规格看起来不对。应该是:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
annotations: 
kubernetes.io/ingress.class: azure/application-gateway
spec:
rules:
- host: service1.domain.com
http:
paths:
- path: /
backend:
service:
name: service1
port:
number: 80
pathType: Prefix      
- host: service2.domain.com
http:
paths:
- path: /
backend:
service:
name: service2
port:
number: 80
pathType: Prefix

规则中应该有两个条目,每个子域一个。httphost是同一项的两个字段

相关内容

  • 没有找到相关文章

最新更新