TIS0301 - Multiple Gateways for Same Host-Port Combination
Multiple Gateway resources exist for the same host-port combination.
To prevent conflicts and ensure consistent behavior, remove duplicate Gateway entries or merge the definitions into a single resource for the same host-port combination.
Examples
-
Two
GatewayObjects Targeting the Same Host and PortFirst
Gateway:apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: gateway-1
namespace: example-namespace
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "example.com"Second
Gateway:apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: gateway-2
namespace: example-namespace
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "example.com"Explanation: Both
Gatewayresources define a server that listens on port 80 for the hostexample.com. Having multipleGatewayresources with the same host-port combination can lead to conflicts and undefined behavior, as Istio may not know which configuration to apply.
Recommendation
Remove duplicate gateway entries or merge the definitions into a single Gateway.
-
Remove Duplicate Gateway Entry
If one of the
Gatewayresources is redundant, remove it to avoid conflicts.kubectl delete gateway gateway-2 -n example-namespace -
Merge Gateway Definitions
Alternatively, merge the definitions into a single
Gatewayto include all necessary configuration for the host-port combination.apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: merged-gateway
namespace: example-namespace
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "example.com"