TIS1102 - VirtualService
Points to Non-Existent Gateway
The VirtualService
is configured to use a gateway that does not exist.
VirtualService
References Valid GatewaysTo avoid configuration issues and ensure traffic is properly routed, update the gateway
field in the VirtualService
to reference an existing gateway, or remove it to use the default mesh
gateway if applicable.
Examples
-
VirtualService
Referencing a Non-Existent GatewayapiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: my-virtual-service
namespace: example-namespace
spec:
hosts:
- "my-app.example.com"
gateways:
- "unknown-gateway"
http:
- route:
- destination:
host: "my-app-service.example-namespace.svc.cluster.local"Explanation: The
VirtualService
references a gateway namedunknown-gateway
, but there is no correspondingGateway
resource defined in the mesh. This prevents theVirtualService
from properly routing external traffic through the intended gateway.
Recommendation
Update the gateway
field to target all necessary gateways or remove the field if the default mesh
gateway is sufficient.
-
Update the
gateway
Field to Target an Existing GatewayUpdate the
gateway
reference to point to a valid gateway that is defined in the mesh.apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: my-virtual-service
namespace: example-namespace
spec:
hosts:
- "my-app.example.com"
gateways:
- "existing-gateway"
http:
- route:
- destination:
host: "my-app-service.example-namespace.svc.cluster.local"Explanation: Correcting the gateway reference to an existing gateway (
existing-gateway
) allows theVirtualService
to function properly by routing traffic through the intended gateway. -
Remove the
gateway
Field to Use the Defaultmesh
GatewayIf no specific gateway is required, you can remove the
gateway
field to use the defaultmesh
gateway.apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: my-virtual-service
namespace: example-namespace
spec:
hosts:
- "my-app-service.example-namespace.svc.cluster.local"
http:
- route:
- destination:
host: "my-app-service.example-namespace.svc.cluster.local"Explanation: Removing the
gateway
field causes theVirtualService
to use the defaultmesh
gateway, which is sufficient for internal routing within the mesh.