Skip to content
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

Add user guide for Egress feature #2371

Merged
merged 1 commit into from
Jul 13, 2021
Merged

Add user guide for Egress feature #2371

merged 1 commit into from
Jul 13, 2021

Conversation

tnqn
Copy link
Member

@tnqn tnqn commented Jul 9, 2021

Signed-off-by: Quan Tian qtian@vmware.com

@tnqn tnqn requested review from jianjuns, abhiraut and antoninbas July 9, 2021 14:18
@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2021

Codecov Report

Merging #2371 (990c2bb) into main (5313dd7) will decrease coverage by 17.74%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2371       +/-   ##
===========================================
- Coverage   59.79%   42.05%   -17.75%     
===========================================
  Files         283      146      -137     
  Lines       22118    18136     -3982     
===========================================
- Hits        13226     7627     -5599     
- Misses       7479     9825     +2346     
+ Partials     1413      684      -729     
Flag Coverage Δ
kind-e2e-tests ?
unit-tests 42.05% <ø> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/agent_linux.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/ovs/openflow/default.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/agent/config/node_config.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/agent/cniserver/pod_configuration_linux.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/apis/controlplane/v1beta1/register.go 0.00% <0.00%> (-92.86%) ⬇️
pkg/ovs/openflow/logs.go 9.52% <0.00%> (-90.48%) ⬇️
pkg/apis/controlplane/register.go 0.00% <0.00%> (-90.00%) ⬇️
pkg/agent/nodeportlocal/k8s/annotations.go 0.00% <0.00%> (-83.88%) ⬇️
pkg/agent/client.go 0.00% <0.00%> (-77.42%) ⬇️
pkg/ovs/ovsconfig/ovs_client_linux.go 0.00% <0.00%> (-76.93%) ⬇️
... and 234 more

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job with the doc, added some suggestions

docs/egress.md Outdated
outside of the cluster, for source tracing in audit logs, or whitelisting
by source IP in external firewall, etc.

- You want to limit outgoing external connections leave the cluster via certain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- You want to limit outgoing external connections leave the cluster via certain
- You want to force outgoing external connections to leave the cluster via certain

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
by source IP in external firewall, etc.

- You want to limit outgoing external connections leave the cluster via certain
Nodes, for security controls, or due to the network topology restriction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or due to network topology restrictions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
IP if it's different from the Node that the Pod runs on and will be SNATed to
the egress IP when leaving that Node.

You may be interested in using this capability if any of the below are true:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You may be interested in using this capability if any of the below are true:
You may be interested in using this capability if any of the following apply:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
podSelector:
matchLabels:
role: web
egressIP: 10.10.0.8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
egressIP: 10.10.0.8
egressIP: 10.10.0.8 # can be populated by Antrea after assigning an IP from the pool below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
the `egressIP` is allocated from an `externalIPPool`**, i.e. when the
`externalIPPool` is specified. If the Node hosting the `egressIP` fails, another
Node will be elected as the new egress Node of this Egress. It will take over
the IP and sends layer 2 advertisement (for example, Gratuitous ARP for IPv4) to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/sends/send

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +98 to +99
selected Pods to the external network should use. **The IP must be reachable
from all Nodes.** The IP can be specified when creating the Egress. Starting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IP must be reachable from all Nodes.

I wonder if this is really necessary. If I have a cluster with Nodes spread over multiple Node subnets, it should be ok to partition my egress IPs over the different subnets, and each egress IP only needs to be reachable from within the subnet in which it is used. I would configure the nodeSelector in my IP pools to only select Nodes within that subnet. But it's probably an unusual scenario and it's easier to frame the requirement as "The IP must be reachable from all Nodes".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IP must be reachable from all Nodes because we use the egress IPs as tunnel destination (to "encap" the snat IP the traffic should use). As any Pod on any Node can use the egress IPs, the source Node must be able to reach the egress IP, otherwise the tunnel traffic would be dropped.
https://github.com/antrea-io/antrea/blob/main/docs/design/ovs-pipeline.md#snattable-71 has details about the SNAT IP as Tunnel destination IP.

docs/egress.md Outdated

The `ipRanges` field contains a list of IP ranges representing the available IPs
of this IP pool. Each IP range may consist of a `cidr` or a pair of `start` and
`end` IPs inclusive.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`end` IPs inclusive.
`end` IPs (which are themselves included in the range).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
Comment on lines 229 to 233
Now, the packets from the Pods with label `app=web` in `prod` Namespace to the
external network will be redirected to `node-4` Node and SNATed to `10.10.0.11`
while the packets from the Pods with label `app=web` in `staging` Namespace to
the external network will be redirected to `node-6` Node and SNATed to
`10.10.0.12`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the prod Namespaces
to the node-4 Node
in the staging Namespaces
to the node-6 Node

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. I assume you mean "in the prod Namespace", not "Namespaces"? I used namespace name label so it can only match one namespace.

docs/egress.md Outdated
`10.10.0.12`.

Finally, if `node-4` Node powers off, `10.10.0.11` will be re-assigned to
another available Node in a short time and the packets from the Pods with label
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/in a short time/quickly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
Comment on lines 283 to 286
Now, the packets from the Pods with in `prod` Namespace to the external network
will be redirected to `node-4` Node and SNATed to `10.10.0.104` while the
packets from the Pods in `staging` Namespace to the external network will be
redirected to `node-5` Node and SNATed to `10.10.0.12`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated Show resolved Hide resolved
docs/egress.md Outdated
The `nodeSelector` field specifies which Nodes the IPs in this pool can be
assigned to. It's useful when you want to limit egress traffic to certain Nodes.
The semantics of the selector is the same as those used elsewhere in Kubernetes,
i.e. both `matchLabel` and `matchExpressions` are supported. It can be empty,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
i.e. both `matchLabel` and `matchExpressions` are supported. It can be empty,
i.e. both `matchLabels` and `matchExpressions` are supported. It can be empty,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@antoninbas antoninbas added this to the Antrea v1.2 release milestone Jul 10, 2021
Copy link
Member Author

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antoninbas @abhiraut thanks for the review.

docs/egress.md Outdated
IP if it's different from the Node that the Pod runs on and will be SNATed to
the egress IP when leaving that Node.

You may be interested in using this capability if any of the below are true:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
outside of the cluster, for source tracing in audit logs, or whitelisting
by source IP in external firewall, etc.

- You want to limit outgoing external connections leave the cluster via certain
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated Show resolved Hide resolved
docs/egress.md Outdated
by source IP in external firewall, etc.

- You want to limit outgoing external connections leave the cluster via certain
Nodes, for security controls, or due to the network topology restriction.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
podSelector:
matchLabels:
role: web
egressIP: 10.10.0.8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated

The `ipRanges` field contains a list of IP ranges representing the available IPs
of this IP pool. Each IP range may consist of a `cidr` or a pair of `start` and
`end` IPs inclusive.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
The `nodeSelector` field specifies which Nodes the IPs in this pool can be
assigned to. It's useful when you want to limit egress traffic to certain Nodes.
The semantics of the selector is the same as those used elsewhere in Kubernetes,
i.e. both `matchLabel` and `matchExpressions` are supported. It can be empty,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
Comment on lines 229 to 233
Now, the packets from the Pods with label `app=web` in `prod` Namespace to the
external network will be redirected to `node-4` Node and SNATed to `10.10.0.11`
while the packets from the Pods with label `app=web` in `staging` Namespace to
the external network will be redirected to `node-6` Node and SNATed to
`10.10.0.12`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. I assume you mean "in the prod Namespace", not "Namespaces"? I used namespace name label so it can only match one namespace.

docs/egress.md Outdated
`10.10.0.12`.

Finally, if `node-4` Node powers off, `10.10.0.11` will be re-assigned to
another available Node in a short time and the packets from the Pods with label
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

docs/egress.md Outdated
Comment on lines 283 to 286
Now, the packets from the Pods with in `prod` Namespace to the external network
will be redirected to `node-4` Node and SNATed to `10.10.0.104` while the
packets from the Pods in `staging` Namespace to the external network will be
redirected to `node-5` Node and SNATed to `10.10.0.12`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

antoninbas
antoninbas previously approved these changes Jul 12, 2021
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

abhiraut
abhiraut previously approved these changes Jul 12, 2021
Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a minor comment/question.

docs/egress.md Outdated

## Usage examples

### Configuring high available Egress
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it should be "highly available", but after some researching I am not very certain now. @antoninbas : comments?

Personally I prefer "Egress with HA", or "auto-failover Egress".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it should either be "highly-available Egress" or "high-availability Egress"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tnqn tnqn dismissed stale reviews from abhiraut and antoninbas via c9ae608 July 13, 2021 02:42
Signed-off-by: Quan Tian <qtian@vmware.com>
@tnqn
Copy link
Member Author

tnqn commented Jul 13, 2021

/skip-all

@tnqn tnqn merged commit 744b853 into antrea-io:main Jul 13, 2021
@tnqn tnqn deleted the egress-doc branch July 13, 2021 06:23
@tnqn tnqn mentioned this pull request Aug 24, 2021
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants