Envoy Gateway Documentation
repository·main·Indexed 25 days ago
https://github.com/envoyproxy/gatewayAn open source project for managing Envoy Proxy as a standalone or Kubernetes-based application gateway using the Kubernetes Gateway API. Documentation covers installation via Helm, management of Gateway API and Envoy Gateway CRDs, and the configuration of observability add-ons including Prometheus, Grafana, Loki, Tempo, Fluent Bit, and OpenTelemetry Collector.
What's inside Envoy Gateway
- Envoy Gateway is an open source project designed to manage Envoy Proxy as either a standalone application gateway or a Kubernetes-based application gateway. It leverages Kubernetes Gateway API resources to dynamically provision and configure managed Envoy Proxies.
Understand the Envoy Gateway Threat Model scope
mainThe Envoy Gateway threat model analyzes security risks associated with deploying and operating Envoy Gateway within a multi-tenant Kubernetes (K8s) cluster.
In Scope:
- Envoy Gateway: Configuration, deployment, and operation (e.g., TLS certificate management, authentication, service-to-service routing).
- Kubernetes Cluster: Network policies, access control, and resource isolation for namespaces/tenants.
- Tenant Workloads: Interaction between tenant pods and Envoy Gateway.
Out of Scope:
- Underlying infrastructure security (e.g., EC2, S3).
- Non-Envoy related Kubernetes components.
- Implementation of Envoy Gateway as an egress traffic controller.
Identify Threat Categories in Envoy Gateway
mainThreats in an Envoy Gateway environment are categorized into three distinct areas to help identify the source and impact of potential vulnerabilities:
- Container Security (CS): General threats to containerized applications, often originating from orchestrator misconfigurations or container vulnerabilities. These are not specific to Envoy Gateway.
- Gateway API (GW): Threats related to the Gateway API specification itself. These involve misconfigurations or excessive permissions on Gateway API resources (e.g.,
HTTPRouteorGateway) that could affect any implementation. - Envoy Gateway (EG): Threats specific to Envoy Gateway or Envoy Proxy configurations and features. Improperly configured features in these components could be leveraged to gain unauthorized access to protected resources.
How Envoy Gateway handles extension resources
mainEnvoy Gateway manages resource watching for extensions to prevent race conditions and reconciliation loops.
- Dynamic Watching: Envoy Gateway uses
controller-runtimeto create watches onUnstructuredresources matching thegroup,version, andkindspecified in theextensionManager.resourcesorextensionManager.policyResourcesconfiguration. - Data Transfer: When a watched resource changes, Envoy Gateway sends the resource as an
Unstructuredobject to the extension via gRPC. - Validation: The extension is responsible for performing its own type validation on the received
Unstructureddata. - Policy Context: For policy resources targeting
Gatewayresources, the policy is provided as context to calls made to theHTTPListenerhook.
- Dynamic Watching: Envoy Gateway uses
Extension resource watching mechanism
mainEnvoy Gateway handles the watching of custom resources introduced by extensions. Instead of the extension creating its own Kubernetes watches, Envoy Gateway uses
controller-runtimeto watchUnstructuredresources matching thegroup,version, andkindconfigured in theextensionManager.resourcesfield.When a resource changes, Envoy Gateway sends the
Unstructuredresource to the extension via gRPC. This prevents race conditions and reconciliation loops. The extension is responsible for performing its own type validation on the received data.Understand the Envoy Gateway Threat Model and Scope
mainThe Envoy Gateway threat model analyzes security risks associated with deploying and operating Envoy Gateway within a multi-tenant Kubernetes (K8s) cluster.
In Scope:
- Envoy Gateway: Configuration, deployment, and operation (including TLS certificate management, authentication, and service-to-service routing).
- Kubernetes Cluster: Network policies, access control, and resource isolation for different namespaces/tenants.
- Tenant Workloads: Interaction between tenant pods and Envoy Gateway.
Out of Scope:
- Underlying infrastructure security (e.g., EC2, S3).
- Non-Envoy related Kubernetes components.
- Implementation of Envoy Gateway as an egress traffic controller.
Understand Gateway API Extensions in Envoy Gateway
mainEnvoy Gateway uses Gateway API Extensions to provide features that are not part of the standard Kubernetes Gateway API. Unlike the legacy Ingress API which relied on non-type-safe annotations, Envoy Gateway extensions use type-safe Custom Resource Definitions (CRDs).
Envoy Gateway employs a policy attachment model. This allows you to apply custom policies to standard Gateway API resources (such as
HTTPRouteorGateway) without modifying the core API. This model ensures a separation of concerns and allows for easier configuration management across different teams.These extensions are processed by the Envoy Gateway control plane and translated into xDS configurations for Envoy Proxy instances, removing the need to manage raw Envoy configuration directly.
Accelerate TLS handshakes using Envoy Private Key Provider
mainYou can accelerate TLS handshakes or protect private keys using specialized hardware by adding an Envoy Private Key Provider to Envoy.
Currently, two private key providers are available as Envoy contrib extensions:
- QAT: Available since Envoy 1.24.
- CryptoMB: Available since Envoy 1.20.
These providers leverage hardware capabilities (like Intel SPR/EMR Xeon server platforms) to speed up TLS operations.
Implement tenant isolation for Envoy Gateways
mainTo prevent co-tenant misconfiguration from compromising traffic confidentiality and integrity, follow these isolation patterns:
- Dedicated Gateways: Provide a dedicated Envoy Gateway to each tenant within their respective namespace.
- One-to-One Mapping: Establish a one-to-one relationship between
GatewayClassandGatewayresources. Each tenant namespace should have its ownGatewayClasswatched by a unique Envoy Gateway Controller (as defined in the Deployment Mode documentation). - Granular Permissions:
- Application Admins: Grant write permissions on the
Gatewayresource, but restricted to their specific namespaces. - Application Developers: Grant write permissions only on
Routeresources. - Follow the Kubernetes Gateway API security model for the 'Advanced 4 Tier Model'.
- Application Admins: Grant write permissions on the
- GitOps Pattern: Optionally, use a GitOps model where only a GitOps operator has permission to deploy or modify custom resources in production environments.
Manage cert-manager resource cleanup
mainTo prevent resource accumulation, you can manage the lifecycle of cert-manager resources:
- Pruning CertificateRequest history: Set the
cert-manager.io/revision-history-limitannotation on your Gateway to allow cert-manager to prune old history. - Cleaning up Secrets: When removing a TLS listener from a Gateway, a Secret may linger. Use the cert-manager flag for cleaning up secrets when certificates are deleted to automate this.
- Manual Cleanup: To completely remove cert-manager and its resources:
- Uninstall cert-manager via Helm:
helm uninstall --namespace cert-manager cert-manager. - Delete the namespace:
kubectl delete namespace/cert-manager. - Manually remove the TLS listener from your Gateway and delete the associated Secret.
- Uninstall cert-manager via Helm:
- Pruning CertificateRequest history: Set the
Protect OIDC secrets and authentication credentials
mainTo prevent the leakage of OIDC client secrets and user password hashes due to misconfigured RBAC, follow these practices:
- Restrict Secret access: Ensure only authorized users and service accounts can access secrets. This is critical in namespaces where
SecurityPolicyobjects are configured, as these namespaces store sensitive credentials. - Minimize RBAC permissions: Reduce the use of
ClusterRolesandRolesthat allowlistandgetoperations onsecrets. - Audit permissions: Perform periodic audits of your RBAC permissions to ensure compliance with the principle of least privilege.
- Restrict Secret access: Ensure only authorized users and service accounts can access secrets. This is critical in namespaces where
Test Envoy Gateway with External LoadBalancer Support
mainIf your cluster has a LoadBalancer implementation, you can test the configuration by sending traffic directly to the Gateway's external IP or hostname.