Configure GatewayAPI Policy
Policies are Kubernetes Custom Resources that extend Gateway and Route resources with advanced capabilities. They use the Policy Attachment pattern via .spec.targetRefs to attach to Gateway API resources (Gateway, HTTPRoute, GRPCRoute), enabling flexible configuration and policy inheritance.
Envoy Gateway currently provides three policy types:
Only SecurityPolicy is supported through the Web console.
TOC
Prerequisites
Please ensure that you have:
SecurityPolicy
Configuration Via Web Console
- Navigate to
Alauda Container Platform -> Networking -> Gateway -> Policies - Select
SecurityPolicyin thePolicy Typedropdown - Click the
Create Policybutton
Common Fields (shared for all policies):
SecurityPolicy Specific Fields:
Configuration Via YAML
Introduction
SecurityPolicy is used to configure authentication, authorization, and other security-related features for your Gateway and Routes. It provides a declarative way to protect your services by validating incoming requests before they reach your backend applications.
Features
- Authentication: Verify the identity of clients using various methods (API Key, JWT, OIDC, Basic Auth)
- Authorization: Control access to resources based on validated credentials
- CORS Configuration: Manage Cross-Origin Resource Sharing policies
How It Works:
- Create a SecurityPolicy with your desired authentication/authorization rules
- Attach it to a specific HTTPRoute/GRPCRoute
- Envoy Gateway validates incoming requests according to the policy
- Valid requests are forwarded to backend services; invalid requests are rejected with appropriate HTTP status codes
Notes
- The web console currently supports configuring API Key Authentication only. For other authentication methods and advanced security features, you need to use YAML configuration.
- Each Route can only be associated with one SecurityPolicy.
- If a SecurityPolicy references a secret with no values, all requests to the attached route will be rejected with
401 Unauthorized. - In the web console, by default, the
Extract Fromfield is set toheaderand theHeader Namefield is set toauthorization. - You can view which policies are attached to a route by navigating to the Route's topology tab in the web console.