Enable Validating Admission Policy as a security engine
Validating Admission Policy (VAP) is a native Kubernetes admission control mechanism. Unlike Gatekeeper, which relies on external webhooks, VAP performs rule validation directly within the kube-apiserver, providing superior stability and performance. In Alibaba Cloud Container Service for Kubernetes (ACK), you can select Common Expression Language (CEL) when you deploy a security policy to enable VAP as the policy enforcement engine. This provides a more efficient and stable way to ensure the security and compliance of your cluster resources.
How VAP works
VAP is a built-in admission capability in Kubernetes that uses declarative CEL expressions to validate rules before a request to create or update a resource object is persisted. Requests that do not meet the conditions are directly rejected by the kube-apiserver.
In ACK, the Policy Management feature integrates VAP, which is enabled by default for clusters running version 1.30 or later. This integration is based on Gatekeeper's multi-engine policy solution. When you deploy a policy instance written in CEL, Gatekeeper automatically converts it into a native ValidatingAdmissionPolicy resource. The original Gatekeeper webhook serves as a fallback mechanism. If VAP enforcement fails, the request falls back to the webhook for a secondary validation, ensuring continuous policy enforcement.
The key differences between VAP and Gatekeeper are as follows.
-
Core architectural differences
Dimension
VAP
Gatekeeper
Deployment dependencies
Built into the kube-apiserver. No additional webhook is required.
Requires separate deployment of the Gatekeeper control plane and webhook components.
Execution path
Executes inside the kube-apiserver with no network overhead.
Calls an external service through a validating webhook, which introduces network latency.
Stability
Higher. It does not depend on the operational status of external components.
Depends on the stability of Gatekeeper components.
Rule language
CEL. Its expressions closely align with the Kubernetes object structure.
Rego and CEL (supports multiple languages)
-
Feature support
Dimension
VAP
Gatekeeper
Auditing existing resources
Not supported
Supported
External data source
Not supported. Rules can only access data within the request object.
Supported. Can reference other resources or external data by using
external_data.Resource mutation (Mutate)
Supported via Mutating Admission Policy (MAP), an Alpha feature in Kubernetes 1.30.
Supported (implemented through its CRDs)
Non-blocking "Warn" action
Supported (
validationActions: [Warn])Supported
Dry run
Supported via the native kube-apiserver dry run mechanism.
Supported
Exemption/exclusion mechanism
Supported (
match/excluderules)Supported (
match/exclude,label, and more)Events/subscriptions
No native event mechanism.
Supported. Provides violation logs, audit events, and more.
Enable VAP in Policy Management
In Policy Management, you can select a policy language to specify the policy engine. The system then automatically uses the corresponding engine to enforce the policy.
-
Rego: Uses the Gatekeeper engine.
-
CEL: Uses the VAP engine.
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
Click the My Policies tab, and then click Create Policy Instance. Configure the policy instance by following the on-screen prompts.
In the Policy Selection section, select the ACKRestrictRoleBindings policy from the compliance category. Set Policy Language to cel to enable VAP, select Deny as the Action, and specify the default namespace in the Scope section. The first time you create a CEL-based policy instance, you must enable the VAP policy audit feature. This allows you to view VAP execution results on the Policy Enforcement Overview page.
By default, the page displays the 100 most recent deny or warn logs from the last 7 days. To view more logs, go to Operations > Log Center, click the Control Plane Component Logs tab, and select the validating-admission-policy logs.
Click Enable in the confirmation dialog box.
-
After the deployment is complete, view the policy enforcement results on the Policy Enforcement Overview page.
Related operations
Modify an existing policy's enforcement engine
You can modify the policy language for an existing policy. However, all instances of a single policy template must use the same policy language. Changing the template's language updates all its instances.
-
Console: On the My Policies page, locate the target policy in the list. In the Policy Language column, click Modify and select a new language.
-
OpenAPI: See DeployPolicyInstance to query, deploy, modify, and delete policy instances in the policy library.