TIS1401 - HTTPRoute
Points to a Non-Existent Kubernetes Gateway
The HTTPRoute
is configured to point to a non-existent Kubernetes gateway.
HTTPRoute
Points to an Existing GatewayTo avoid routing issues, ensure the parentRefs
in HTTPRoute
references an existing gateway in the cluster.
Examples
-
HTTPRoute
Referencing a Non-Existent GatewayapiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
name: my-http-route
namespace: example-namespace
spec:
parentRefs:
- name: non-existent-gateway
namespace: example-namespace
rules:
- matches:
- path:
type: Prefix
value: "/myapp"
backendRefs:
- name: my-app-service
port: 80Explanation: The
HTTPRoute
is referencing a gateway namednon-existent-gateway
that does not exist in the namespace. This prevents theHTTPRoute
from being properly applied, leading to routing issues.
Recommendation
Update the parentRefs
field to target an existing gateway.
-
Update the
parentRefs
to Point to an Existing GatewayUpdate the
HTTPRoute
to reference a valid gateway.apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
name: my-http-route
namespace: example-namespace
spec:
parentRefs:
- name: existing-gateway
namespace: example-namespace
rules:
- matches:
- path:
type: Prefix
value: "/myapp"
backendRefs:
- name: my-app-service
port: 80Explanation: By updating the
parentRefs
to point to an existing gateway (existing-gateway
), theHTTPRoute
is properly applied and traffic can be routed correctly through the gateway.