# Using Egress Policy ## Currently supported CNIs for EgressGateway === "Calico" If your cluster uses [Calico](https://www.tigera.io/project-calico/) CNI, run the following command to ensure that EgressGateway's iptables rules are not overridden by Calico rules. Otherwise, EgressGateway will not work. ```shell # set chainInsertMode $ kubectl patch felixconfigurations default --type='merge' -p '{"spec":{"chainInsertMode":"Append"}}' # check status $ kubectl get FelixConfiguration default -o yaml apiVersion: crd.projectcalico.org/v1 kind: FelixConfiguration metadata: generation: 2 name: default resourceVersion: "873" uid: 0548a2a5-f771-455b-86f7-27e07fb8223d spec: chainInsertMode: Append ...... ``` > For details about `spec.chainInsertMode`, refer to [Calico documentation](https://projectcalico.docs.tigera.io/reference/resources/felixconfig). === "Flannel" [Flannel](https://github.com/flannel-io/flannel) CNI does not require any configuration, you can skip this step. === "Weave" [Weave](https://github.com/flannel-io/flannel) CNI does not require any configuration, you can skip this step. === "Spiderpool" If your cluster uses [Spiderpool](https://github.com/spidernet-io/spiderpool) in conjunction with other CNIs, you need to perform the following steps. Add the addresses of external services outside the cluster to the 'hijackCIDR' field of the 'default' object in spiderpool.spidercoordinators. This ensures that when Pods access these external services, the traffic goes through the host where the Pod is located, allowing it to match the EgressGateway rules. Assuming "1.1.1.1/32" and "2.2.2.2/32" are the addresses of the external services. For already running Pods, you need to restart them for these routing rules to take effect within the Pods. ```shell kubectl patch spidercoordinators default --type='merge' -p '{"spec": {"hijackCIDR": ["1.1.1.1/32", "2.2.2.2/32"]}}' ``` ## Verify EgressGateway is running properly Confirm that all EgressGateway Pods are running correctly. ```shell $ kubectl get pod -n kube-system | grep egressgateway egressgateway-agent-29lt5 1/1 Running 0 9h egressgateway-agent-94n8k 1/1 Running 0 9h egressgateway-agent-klkhf 1/1 Running 0 9h egressgateway-controller-5754f6658-7pn4z 1/1 Running 0 9h ``` ## Create EgressGateway instances 1. EgressGateway defines a set of nodes as the cluster's egress gateway, and egress traffic from within the cluster will be forwarded through this set of nodes to exit the cluster. Therefore, we need to define a set of EgressGateway instances in advance. Here is an example: ```shell cat <