同一臺主機,我有兩個服務,tea
和coffee
,每一個在自己的命名空間,我想domain.com
去tea
服務和domain.com/coffee
去coffee
。Kubernetes入口在不同的命名空間
由於每個命名空間都必須創建兩個入口,但是當我嘗試應用它們時,出現錯誤MAPPING Path '/coffee' already defined in another Ingress rule
。
我的兩個入口的片如下所示:
茶:
kind: Ingress
apiVersion: extensions/v1beta1
spec:
tls:
- hosts:
- domain.com
secretName: tea-tls
rules:
- host: domain.com
http:
paths:
- path:/
backend:
serviceName: tea
servicePort: 80
和咖啡:
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: coffee
namespace: coffee
spec:
tls:
- hosts:
- domain.com
secretName: coffee}-tls
rules:
- host: domain.com
http:
paths:
- path: /coffee
backend:
serviceName: coffee
servicePort: 80
- path: /coffee/*
backend:
serviceName: coffee
servicePort: 80