Policies

Learn more about the custom resources that you can use to apply policies in kgateway.

While the Kubernetes Gateway API allows you to do simple routing, such as to match, redirect, or rewrite requests, you might want additional capabilities in your API gateway, such direct responses, local rate limiting, or request and response transformations. Policies allow you to apply intelligent traffic management, resiliency, and security standards to an HTTPRoute or Gateway.

Policy CRDs

Kgateway uses the following custom resources to attach policies to routes and gateway listeners.

Supported policies

Review the policies that you can configure in kgateway and the level at which you can apply them.

Policy Applied via
Access logging HTTPListenerPolicy
Buffering TrafficPolicy
CSRF TrafficPolicy
Direct response DirectResponse
Dynamic Forward Proxy (DFP) Backend and HTTPRoute
External authorization GatewayExtension and TrafficPolicy
External processing (ExtProc) TrafficPolicy
Health checks for the Gateway HTTPListenerPolicy
Health checks for the Backends BackendConfigPolicy
Outlier detection BackendConfigPolicy
Rate limiting TrafficPolicy
Session affinity - Simple load balancing BackendConfigPolicy
Session affinity - Consistent hashing BackendConfigPolicy
Transformations TrafficPolicy

Policy behavior

<a class=“hextra-card hx-group hx-flex hx-flex-col hx-justify-start hx-overflow-hidden hx-rounded-lg hx-border hx-border-gray-200 hx-text-current hx-no-underline dark:hx-shadow-none hover:hx-shadow-gray-100 dark:hover:hx-shadow-none hx-shadow-gray-100 active:hx-shadow-sm active:hx-shadow-gray-200 hx-transition-all hx-duration-200 hover:hx-border-gray-300 hx-bg-transparent hx-shadow-sm dark:hx-border-neutral-800 hover:hx-bg-slate-50 hover:hx-shadow-md dark:hover:hx-border-neutral-700 dark:hover:hx-bg-neutral-900"href=“global-attachment” >Global policy attachment Policy merging