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
Gateway
Objects 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
Gateway
resources define a server that listens on port 80 for the hostexample.com
. Having multipleGateway
resources 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
Gateway
resources 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
Gateway
to 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"