TIS1003 - OutboundTrafficPolicy with Empty Mode Value Is Ambiguous
An OutboundTrafficPolicy with an empty mode value is ambiguous due to an Istio limitation. This may indicate either ALLOW_ANY or REGISTRY_ONLY. The mode value needs to be explicitly defined to avoid confusion.
OutboundTrafficPolicy Is Explicitly SetTo avoid ambiguity and ensure consistent behavior, explicitly set the outboundTrafficPolicy mode in the Sidecar resource to either ALLOW_ANY or REGISTRY_ONLY based on your traffic control requirements.
Examples
-
SidecarResource with AmbiguousOutboundTrafficPolicyapiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
name: my-sidecar
namespace: example-namespace
spec:
egress:
- hosts:
- "*/*"
outboundTrafficPolicy: {}Explanation: The
outboundTrafficPolicyfield is defined but has an empty value, which causes ambiguity regarding the policy's mode. Istio may interpret this as eitherALLOW_ANY(allowing outbound traffic to any destination) orREGISTRY_ONLY(restricting traffic to known destinations in the service registry). This ambiguity can lead to inconsistent behavior and unintentional access issues.
Recommendation
Correct the outboundTrafficPolicy in the Sidecar resource by explicitly setting the mode.
-
Set Explicit Mode for
OutboundTrafficPolicyTo avoid ambiguity, set the
outboundTrafficPolicymode to eitherALLOW_ANYorREGISTRY_ONLYbased on your intended traffic policy.apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
name: my-sidecar
namespace: example-namespace
spec:
egress:
- hosts:
- "*/*"
outboundTrafficPolicy:
mode: ALLOW_ANYExplanation: Setting the
outboundTrafficPolicymode toALLOW_ANYclearly specifies that the sidecar should allow outbound traffic to any destination, removing any ambiguity. Alternatively, you can set the mode toREGISTRY_ONLYif you want to restrict outbound traffic to registered services. -
Example with
REGISTRY_ONLYModeIf you intend to restrict outbound traffic, set the mode to
REGISTRY_ONLY.apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
name: my-sidecar
namespace: example-namespace
spec:
egress:
- hosts:
- "*/*"
outboundTrafficPolicy:
mode: REGISTRY_ONLYExplanation: Setting the
outboundTrafficPolicymode toREGISTRY_ONLYensures that the sidecar only allows outbound traffic to services that are explicitly registered in the service registry, enhancing security.