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
-
Sidecar
Resource with AmbiguousOutboundTrafficPolicy
apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
name: my-sidecar
namespace: example-namespace
spec:
egress:
- hosts:
- "*/*"
outboundTrafficPolicy: {}Explanation: The
outboundTrafficPolicy
field 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
OutboundTrafficPolicy
To avoid ambiguity, set the
outboundTrafficPolicy
mode to eitherALLOW_ANY
orREGISTRY_ONLY
based 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
outboundTrafficPolicy
mode toALLOW_ANY
clearly specifies that the sidecar should allow outbound traffic to any destination, removing any ambiguity. Alternatively, you can set the mode toREGISTRY_ONLY
if you want to restrict outbound traffic to registered services. -
Example with
REGISTRY_ONLY
ModeIf 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
outboundTrafficPolicy
mode toREGISTRY_ONLY
ensures that the sidecar only allows outbound traffic to services that are explicitly registered in the service registry, enhancing security.