# Create EgressPolicy EgressPolicy is used to define which Pod's outbound traffic needs to be forwarded through the EgressGateway node, and to define other configuration details. When a matching Pod accesses any address outside the cluster (any address that is not a Node IP, CNI Pod CIDR, or ClusterIP), it will be forwarded by the EgressGateway Node. Currently, EgressPolicy is divided into two categories: namespace-level policies and cluster-level policies. - __Namespace-level__ : The scope of the created policy is at the namespace level. - __Cluster-level__ : The scope of the created policy is at the cluster level. ## Create Namespace EgressPolicy 1. Click on __Gateway Policy__ -> __Create Namespace Policy__ , and fill in the following parameters: **Basic Information**: * __Policy Name__ : Enter the name of the policy to be created. * __Description__ : Define the description of the policy to be created. * __Namespace__ : The namespace where the policy will take effect, in this example, select __default__ . * __Gateway Selection__ : Specify which already created [Egress Gateway instance](../egressgateway/create_eg.md) to use. **Outbound Address**: * __Outbound IP Address__ : Use a separate VIP as the outbound IP. Since EgressGateway operates on the basis of ARP, it is suitable for traditional networks where the source IP is always fixed. If not set, the default VIP will be used, and the IP value must be within the IP pool range of the EgressGateway. You can choose the IP in two ways: * __Specify Outbound IP Address__ : Specify a specific IP address as the outbound IP. * __Specify Allocation Policy__ : Use the default outbound IP or select an IP from the pool as the outbound IP through round-robin allocation. * __Node IP Address__ : Use the node's IP address as the outbound IP. This is suitable for public cloud and traditional network environments, but the disadvantage is that the outbound source IP may change with node failures. The corresponding field information is __spec.egressIP.useNodeIP=true__ . **Source Address Pods** : __Select Pods__ : Support selecting source address Pods through __label selectors__ or __source addresses__ , specifying the range of Pods where this policy will take effect. When a matching Pod accesses any address outside the cluster (any address that is not a Node IP, CNI Pod CIDR, or ClusterIP), it will be forwarded by the EgressGateway Node. * __Label Selectors__ : Specify the source address Pods using labels. * __Source Address__ : Add whitelist by adding source address CIDR address segments, locking the Pods that will be affected by this policy. **Advanced Settings** : __Destination Address__ : Specify a whitelist of destination addresses. When specified, this policy will only apply to the defined destination addresses. Supports input in various formats such as single IP address, IP range, CIDR, etc. Default is to apply to all destination addresses. 2. Click **OK** after inputting the details to complete the creation. ## Create Cluster EgressPolicy 1. Click on __Gateway Policy__ -> __Create Cluster Policy__ , and refer to the parameters for basic information, outbound address, and Pod selection as described in [Create Namespace EgressPolicy](#create-namespace-egresspolicy). **Advanced Settings** : * __Namespace Selector__ : Select namespaces using labels, and the policy will apply to the selected namespaces. * __Destination Address__ : Similar to creating namespace Egress Gateway policies. 2. Click **OK** after inputting the details to complete the creation. ## Create EgressPolicy Using YAML 1. Create the EgressPolicy YAML ```shell cat <