Skip to content

Commit 2c4f702

Browse files
committed
update docs for NLB instance support
1 parent edaddf5 commit 2c4f702

File tree

4 files changed

+121
-47
lines changed

4 files changed

+121
-47
lines changed

docs/guide/service/annotations.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
| [service.beta.kubernetes.io/load-balancer-source-ranges](#lb-source-ranges) | stringList | | |
1515
| [service.beta.kubernetes.io/aws-load-balancer-type](#lb-type) | string | | |
1616
| [service.beta.kubernetes.io/aws-load-balancer-nlb-target-type](#nlb-target-type) | string | | |
17-
| service.beta.kubernetes.io/aws-load-balancer-name | string | | |
18-
| [service.beta.kubernetes.io/aws-load-balancer-internal](#lb-internal) | boolean | false | |
17+
| [service.beta.kubernetes.io/aws-load-balancer-name](#load-balancer-name) | string | | |
18+
| [service.beta.kubernetes.io/aws-load-balancer-internal](#lb-internal) | boolean | false | deprecated, in favor of [aws-load-balancer-scheme](#lb-scheme)|
19+
| [service.beta.kubernetes.io/aws-load-balancer-scheme](#lb-scheme) | string | internal | |
1920
| [service.beta.kubernetes.io/aws-load-balancer-proxy-protocol](#proxy-protocol-v2) | string | | Set to `"*"` to enable |
20-
| service.beta.kubernetes.io/aws-load-balancer-ip-address-type | string | ipv4 | ipv4 \| dualstack |
21+
| [service.beta.kubernetes.io/aws-load-balancer-ip-address-type](#ip-address-type) | string | ipv4 | ipv4 \| dualstack |
2122
| service.beta.kubernetes.io/aws-load-balancer-access-log-enabled | boolean | false | |
2223
| service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name | string | | |
2324
| service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix | string | | |
@@ -45,6 +46,16 @@
4546
## Traffic Routing
4647
Traffic Routing can be controlled with following annotations:
4748

49+
- <a name="load-balancer-name">`service.beta.kubernetes.io/aws-load-balancer-name`</a> specifies the custom name to use for the load balancer.
50+
51+
!!!note "limitations"
52+
- If you modify this annotation after service creation, there is no effect.
53+
54+
!!!example
55+
```
56+
service.beta.kubernetes.io/load-balancer-name: custom-name
57+
```
58+
4859
- <a name="lb-type">`service.beta.kubernetes.io/aws-load-balancer-type`</a> specifies the load balancer type. This controller reconciles those service resources with this annotation set to either `nlb-ip` or `external`.
4960

5061
!!!note ""
@@ -64,7 +75,7 @@ Traffic Routing can be controlled with following annotations:
6475
- `instance` mode will route traffic to all EC2 instances within cluster on the [NodePort](https://kubernetes.io/docs/concepts/services-networking/service/#nodeport) opened for your service.
6576

6677
!!!note ""
67-
service must be of type "NodePort" or "LoadBalancer" for `instance` targets
78+
service must be of type `NodePort` or `LoadBalancer` for `instance` targets
6879

6980
- `ip` mode will route traffic directly to the pod IP.
7081

@@ -119,6 +130,16 @@ on the load balancer.
119130
service.beta.kubernetes.io/aws-load-balancer-target-node-labels: label1=value1, label2=value2
120131
```
121132

133+
## Traffic Listening
134+
Traffic Listening can be controlled with following annotations:
135+
136+
- <a name="ip-address-type">`service.beta.kubernetes.io/aws-load-balancer-ip-address-type`</a> specifies the [IP address type](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#ip-address-type) of NLB.
137+
138+
!!!example
139+
```
140+
service.beta.kubernetes.io/aws-load-balancer-ip-address-type: ipv4
141+
```
142+
122143
## Resource attributes
123144
NLB resource attributes can be controlled via the following annotations:
124145

@@ -176,8 +197,18 @@ Load balancer access can be controllerd via following annotations:
176197
service.beta.kubernetes.io/load-balancer-source-ranges: 10.0.0.0/24
177198
```
178199

200+
- <a name="lb-scheme">`service.beta.kubernetes.io/aws-load-balancer-scheme`</a> specifies whether the NLB will be internet-facing or internal. Valid values are `internal`, `internet-facing`. If not specified, default is `internal`.
201+
202+
!!!example
203+
```
204+
service.beta.kubernetes.io/aws-load-balancer-scheme: "internet-facing"
205+
```
206+
179207
- <a name="lb-internal">`service.beta.kubernetes.io/aws-load-balancer-internal`</a> specifies whether the NLB will be internet-facing or internal.
180208

209+
!!!note "deprecation note"
210+
This annotation is deprecated starting v2.2.0 release in favor of the new [aws-load-balancer-scheme](#lb-scheme) annotation. It will will be supported, but in case of ties, the aws-load-balancer-scheme gets precedence.
211+
181212
!!!example
182213
```
183214
service.beta.kubernetes.io/aws-load-balancer-internal: "true"

docs/guide/service/nlb.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Network Load Balancer
2+
AWS Load Balancer Controller supports Network Load Balancer (NLB) with instance or IP targets through Kubernetes service of type `LoadBalancer` with proper annotations.
3+
4+
### Instance mode
5+
Instance target mode supports pods running on AWS EC2 instances. In this mode, AWS NLB sends traffic to the instances and the `kube-proxy` on the individual worker nodes forward it to the pods through one or more worker nodes in the Kubernetes cluster.
6+
### IP mode
7+
IP target mode supports pods running on AWS EC2 instances and AWS Fargate. In this mode, the AWS NLB targets traffic directly to the Kubernetes pods behind the service, eliminating the need for an extra network hop through the worker nodes in the Kubernetes cluster.
8+
9+
## Prerequisites
10+
* AWS LoadBalancer Controller >= v2.2.0
11+
* Kubernetes >= v1.16 for Service type `NodePort`
12+
* Kubernetes >= v1.20 or EKS >= 1.16 or the following patch releases for Service type `LoadBalancer`
13+
- 1.18.18+ for 1.18
14+
- 1.19.10+ for 1.19
15+
* Pods have native AWS VPC networking configured, see [Amazon VPC CNI plugin](https://github.com/aws/amazon-vpc-cni-k8s)
16+
17+
!!!note "secure by default"
18+
Starting v2.2.0 release, the AWS Load balancer controller provisions an internal NLB by default. To create an internet-facing load balancer, apply the following annotation to your service:
19+
20+
```
21+
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
22+
```
23+
24+
For backwards compatibility, if this annotation is not specified, existing NLB will continue to use the scheme configured on the AWS resource.
25+
26+
## Configuration
27+
The service resources of type `LoadBalancer` also get reconciled by the kubernetes controller built into the cloudprovider component of the `kube-controller-manager` or the `cloud-controller-manager` aka the `in-tree` controller. The AWS in-tree controller
28+
ignores those services resources that have the `service.beta.kubernetes.io/aws-load-balancer-type` annotation as `external`. The AWS Load balancer controller support for NLB is based on the in-tree cloud controller ignoring the service resources, so it is very important
29+
to apply the following annotation on the service resource during creation:
30+
31+
```yaml
32+
service.beta.kubernetes.io/aws-load-balancer-type: "external"
33+
```
34+
This `external` value to the above annotation causes the in-tree controller to not process the service resource and thus pass it on to the external controller.
35+
36+
!!!warning "annotation modification"
37+
Do not modify or add the `service.beta.kubernetes.io/aws-load-balancer-type` annotation on an existing service object. If you need to make changes, for example from classic to NLB or NLB managed
38+
by the in-tree controller to the one managed by the AWS Load balancer controller, delete the kubernetes service first and then create again with the correct annotation. If you modify the annotation after service creation
39+
you will end up with leaked AWS load balancer resources.
40+
41+
### IP mode
42+
NLB IP mode is determined based on the `service.beta.kubernetes.io/aws-load-balancer-nlb-target-type` annotation. If the annotation value is `ip`, then NLB will be provisioned in IP mode. Here is the manifest snippet:
43+
```yaml
44+
metadata:
45+
name: my-service
46+
annotations:
47+
service.beta.kubernetes.io/aws-load-balancer-type: "external"
48+
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "ip"
49+
```
50+
51+
!!!note "backwards compatibility"
52+
For backwards compatibility, controller still supports the `nlb-ip` as the type annotation. For example, if you specify
53+
54+
```
55+
service.beta.kubernetes.io/aws-load-balancer-type: nlb-ip
56+
```
57+
58+
the controller will provision NLB in IP mode. With this, the `service.beta.kubernetes.io/aws-load-balancer-nlb-target-type` annotation gets ignored.
59+
60+
### Instance mode
61+
Similar to the IP mode, the instance mode is based on the annotation `service.beta.kubernetes.io/aws-load-balancer-type` value `instance`. Here is a sample manifest snippet:
62+
63+
```yaml
64+
metadata:
65+
name: my-service
66+
annotations:
67+
service.beta.kubernetes.io/aws-load-balancer-type: "external"
68+
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "instance"
69+
```
70+
71+
## Protocols
72+
Support is available for both TCP and UDP protocols. In case of TCP, NLB in IP mode does not pass the client source IP address to the pods. You can configure [NLB proxy protocol v2](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#proxy-protocol) via [annotation](https://kubernetes.io/docs/concepts/services-networking/service/#proxy-protocol-support-on-aws) if you need the client source IP address.
73+
74+
to enable proxy protocol v2, apply the following annotation to your service:
75+
```yaml
76+
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*"
77+
```
78+
79+
## Subnet tagging requirements
80+
See [Subnet Discovery](https://kubernetes-sigs.github.io/aws-load-balancer-controller/guide/controller/subnet_discovery/) for details on configuring ELB for public or private placement.
81+
82+
83+
## Security group
84+
NLB does not currently support a managed security group. For ingress access, the controller will resolve the security group for the ENI corresponding to the endpoint pod for IP mode, and the security group of the worker nodes for instance mode. If there is a single security group attached to the the ENI or the instance, it gets used. In case of multiple security groups, the controller expects to find only one security group tagged with the Kubernetes cluster id. Controller will update the ingress rules on the security groups as per the service spec.

docs/guide/service/nlb_ip_mode.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ nav:
2121
- IngressClass: guide/ingress/ingress_class.md
2222
- Certificate Discovery: guide/ingress/cert_discovery.md
2323
- Service:
24-
- NLB-IP mode: guide/service/nlb_ip_mode.md
24+
- NLB: guide/service/nlb.md
2525
- Annotations: guide/service/annotations.md
2626
- TargetGroupBinding:
2727
- TargetGroupBinding: guide/targetgroupbinding/targetgroupbinding.md
@@ -63,4 +63,4 @@ markdown_extensions:
6363
extra_css:
6464
- https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css
6565
extra_javascript:
66-
- https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js
66+
- https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js

0 commit comments

Comments
 (0)