Enabling requests to Knative services when additional authorization policies are enabled

    You must meet the following prerequisites to use Istio AuthorizationPolicy:

    Because Knative requests are frequently routed through activator, some considerations need to be made when using mutual TLS.

    Generally, mutual TLS can be configured normally as in Istio’s documentation. However, since the activator can be in the request path of Knative services, it must have sidecars injected. The simplest way to do this is to label the namespace:

    If the activator isn’t injected:

    • In STRICT mode, requests will simply be rejected.

    This also means that many Istio AuthorizationPolicies won’t work as expected. For example, if you set up a rule allowing requests from a particular source into a Knative service, you will see requests being rejected if they are forwarded by the activator.

    For example, the following policy allows requests from within pods in the serving-tests namespace to other pods in the namespace.

    Requests here will fail when forwarded by the activator, because the Istio proxy at the destination service will see the source namespace of the requests as knative-serving, which is the namespace of the activator.

    Currently, the easiest way around this is to explicitly allow requests from the knative-serving namespace, for example by adding it to the list in the above policy:

    In addition to allowing your application path, you’ll need to configure Istio AuthorizationPolicy to allow health checking and metrics collection to your applications from system pods. You can allow access from system pods .

    • /metrics

    The /metrics path allows the autoscaler pod to collect metrics. The /healthz path allows system pods to probe the service.

    You can add the /metrics and paths to the AuthorizationPolicy as shown in the example:

    Was this page helpful?

    Glad to hear it! Please tell us how we can improve.

    Sorry to hear that. Please .