-
Notifications
You must be signed in to change notification settings - Fork 138
Add allowedSourcePrefixes annotation documentation #2613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| --- | ||
| description: Allow pods to send traffic with a source IP address outside their own using the allowedSourcePrefixes annotation. | ||
| --- | ||
|
|
||
| # Allow pods to use additional source IP prefixes | ||
|
|
||
| ## Big picture | ||
|
|
||
| Allow pods to send egress traffic using source IP addresses outside their own pod IP, by specifying allowed source prefixes. | ||
|
|
||
| ## Value | ||
|
|
||
| By default, Calico blocks egress traffic from a pod when the source IP does not match the pod's IP. This prevents IP spoofing. Some workloads, such as a pod that acts as a transparent proxy and preserves the original client source IP, need to send traffic with a different source address. The `allowedSourcePrefixes` annotation relaxes the spoofing check for the prefixes you list on a specific pod. | ||
|
|
||
| ## Concepts | ||
|
|
||
| ### Source IP spoofing protection | ||
|
|
||
| Calico programs dataplane rules that drop egress packets from a pod when the source IP does not match the pod's own IP. The `allowedSourcePrefixes` annotation relaxes this restriction for specific IP prefixes on a per-pod basis. It works with both the iptables/nftables and the eBPF dataplanes. | ||
|
Check failure on line 19 in calico-cloud/networking/configuring/allowed-source-prefixes.mdx
|
||
|
|
||
| ### FelixConfiguration prerequisite | ||
|
|
||
| Allowing non-pod source IPs is security-sensitive, so Felix rejects the annotation by default. You must opt in by setting `workloadSourceSpoofing` to `Any` in the FelixConfiguration resource. Until you do, a pod that requests source prefixes is not programmed into the dataplane. | ||
|
Check failure on line 23 in calico-cloud/networking/configuring/allowed-source-prefixes.mdx
|
||
|
|
||
| ## Before you begin... | ||
|
|
||
| - Your cluster must be using Calico CNI to use this feature. See [Configuring the Calico CNI Plugins](../../reference/component-resources/configuration.mdx). | ||
| - Enable `workloadSourceSpoofing` in the FelixConfiguration resource: | ||
|
|
||
| ```yaml | ||
| apiVersion: projectcalico.org/v3 | ||
| kind: FelixConfiguration | ||
| metadata: | ||
| name: default | ||
| spec: | ||
| workloadSourceSpoofing: Any | ||
| ``` | ||
|
|
||
| :::caution | ||
|
|
||
| Setting `workloadSourceSpoofing` to `Any` lets any pod that carries the annotation send traffic with arbitrary source IPs. Use admission control to restrict which pods can set the annotation. | ||
|
|
||
| ::: | ||
|
|
||
| ## How to | ||
|
|
||
| Annotate the pod with `cni.projectcalico.org/allowedSourcePrefixes` set to a JSON list of CIDRs. For example: | ||
|
|
||
| ```yaml | ||
| cni.projectcalico.org/allowedSourcePrefixes: '["192.168.10.0/24"]' | ||
| ``` | ||
|
|
||
| The annotation must be present when the pod is created; adding it later has no effect. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| --- | ||
| description: Allow pods to send traffic with a source IP address outside their own using the allowedSourcePrefixes annotation. | ||
| --- | ||
|
|
||
| # Allow pods to use additional source IP prefixes | ||
|
|
||
| ## Big picture | ||
|
|
||
| Allow pods to send egress traffic using source IP addresses outside their own pod IP, by specifying allowed source prefixes. | ||
|
|
||
| ## Value | ||
|
|
||
| By default, Calico blocks egress traffic from a pod when the source IP does not match the pod's IP. This prevents IP spoofing. Some workloads, such as a pod that acts as a transparent proxy and preserves the original client source IP, need to send traffic with a different source address. The `allowedSourcePrefixes` annotation relaxes the spoofing check for the prefixes you list on a specific pod. | ||
|
|
||
| ## Concepts | ||
|
|
||
| ### Source IP spoofing protection | ||
|
|
||
| Calico programs dataplane rules that drop egress packets from a pod when the source IP does not match the pod's own IP. The `allowedSourcePrefixes` annotation relaxes this restriction for specific IP prefixes on a per-pod basis. It works with both the iptables/nftables and the eBPF dataplanes. | ||
|
Check failure on line 19 in calico-enterprise/networking/configuring/allowed-source-prefixes.mdx
|
||
|
|
||
| ### FelixConfiguration prerequisite | ||
|
|
||
| Allowing non-pod source IPs is security-sensitive, so Felix rejects the annotation by default. You must opt in by setting `workloadSourceSpoofing` to `Any` in the FelixConfiguration resource. Until you do, a pod that requests source prefixes is not programmed into the dataplane. | ||
|
|
||
| ## Before you begin... | ||
|
|
||
| - Your cluster must be using Calico CNI to use this feature. See [Configuring the Calico CNI Plugins](../../reference/component-resources/configuration.mdx). | ||
| - Enable `workloadSourceSpoofing` in the FelixConfiguration resource: | ||
|
|
||
| ```yaml | ||
| apiVersion: projectcalico.org/v3 | ||
| kind: FelixConfiguration | ||
| metadata: | ||
| name: default | ||
| spec: | ||
| workloadSourceSpoofing: Any | ||
| ``` | ||
|
|
||
| :::caution | ||
|
|
||
| Setting `workloadSourceSpoofing` to `Any` lets any pod that carries the annotation send traffic with arbitrary source IPs. Use admission control to restrict which pods can set the annotation. | ||
|
|
||
| ::: | ||
|
|
||
| ## How to | ||
|
|
||
| Annotate the pod with `cni.projectcalico.org/allowedSourcePrefixes` set to a JSON list of CIDRs. For example: | ||
|
|
||
| ```yaml | ||
| cni.projectcalico.org/allowedSourcePrefixes: '["192.168.10.0/24"]' | ||
| ``` | ||
|
|
||
| The annotation must be present when the pod is created; adding it later has no effect. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| --- | ||
| description: Allow pods to send traffic with a source IP address outside their own using the allowedSourcePrefixes annotation. | ||
| --- | ||
|
|
||
| # Allow pods to use additional source IP prefixes | ||
|
|
||
| ## Big picture | ||
|
|
||
| Allow pods to send egress traffic using source IP addresses outside their own pod IP, by specifying allowed source prefixes. | ||
|
|
||
| ## Value | ||
|
|
||
| By default, Calico blocks egress traffic from a pod when the source IP does not match the pod's IP. This prevents IP spoofing. Some workloads, such as a pod that acts as a transparent proxy and preserves the original client source IP, need to send traffic with a different source address. The `allowedSourcePrefixes` annotation relaxes the spoofing check for the prefixes you list on a specific pod. | ||
|
|
||
| ## Concepts | ||
|
|
||
| ### Source IP spoofing protection | ||
|
|
||
| Calico programs dataplane rules that drop egress packets from a pod when the source IP does not match the pod's own IP. The `allowedSourcePrefixes` annotation relaxes this restriction for specific IP prefixes on a per-pod basis. It works with both the iptables/nftables and the eBPF dataplanes. | ||
|
|
||
| ### FelixConfiguration prerequisite | ||
|
|
||
| Allowing non-pod source IPs is security-sensitive, so Felix rejects the annotation by default. You must opt in by setting `workloadSourceSpoofing` to `Any` in the FelixConfiguration resource. Until you do, a pod that requests source prefixes is not programmed into the dataplane. | ||
|
|
||
| ## Before you begin... | ||
|
|
||
|
tomastigera marked this conversation as resolved.
|
||
| - Your cluster must be using Calico CNI to use this feature. See [Configuring the Calico CNI Plugins](../../reference/configure-cni-plugins.mdx). | ||
| - Enable `workloadSourceSpoofing` in the FelixConfiguration resource: | ||
|
|
||
| ```yaml | ||
| apiVersion: projectcalico.org/v3 | ||
| kind: FelixConfiguration | ||
| metadata: | ||
| name: default | ||
| spec: | ||
| workloadSourceSpoofing: Any | ||
| ``` | ||
|
|
||
| :::caution | ||
|
|
||
| Setting `workloadSourceSpoofing` to `Any` lets any pod that carries the annotation send traffic with arbitrary source IPs. Use admission control to restrict which pods can set the annotation. | ||
|
|
||
| ::: | ||
|
|
||
| ## How to | ||
|
|
||
| Annotate the pod with `cni.projectcalico.org/allowedSourcePrefixes` set to a JSON list of CIDRs. For example: | ||
|
|
||
| ```yaml | ||
| cni.projectcalico.org/allowedSourcePrefixes: '["192.168.10.0/24"]' | ||
| ``` | ||
|
|
||
| The annotation must be present when the pod is created; adding it later has no effect. | ||
Uh oh!
There was an error while loading. Please reload this page.