Skip to content

Commit 98a3984

Browse files
authored
revise install guide (#2704)
* revise install guide * fixup * fixup
1 parent aff9e62 commit 98a3984

File tree

1 file changed

+78
-59
lines changed

1 file changed

+78
-59
lines changed

docs/deploy/installation.md

Lines changed: 78 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,74 @@
11
# Load Balancer Controller Installation
22

3-
## Kubernetes version requirements
3+
The Load Balancer controller (LBC) provisions AWS Network Load Balancer (NLB) and Application Load Balancer (ALB) resources. The LBC watches for new service or ingress kubernetes resources, and configures AWS resources.
4+
5+
The LBC is supported by AWS. Some clusters may using legeacy "in-tree" functionality to provision AWS load balancers. The AWS Load Balancer Controller should be installed instead.
6+
7+
!!!question "Existing AWS ALB Ingress Controller users"
8+
AWS ALB Ingress controller must be uninstalled before installing AWS Load Balancer controller.
9+
Please follow our [migration guide](upgrade/migrate_v1_v2.md) to do migration.
10+
11+
## Supported Kubernetes Versions
412
* AWS Load Balancer Controller v2.0.0~v2.1.3 requires Kubernetes 1.15+
513
* AWS Load Balancer Controller v2.2.0~v2.3.1 requires Kubernetes 1.16-1.21
614
* AWS Load Balancer Controller v2.4.0+ requires Kubernetes 1.19+
715

8-
!!!warning "Existing AWS ALB Ingress Controller users"
9-
AWS ALB Ingress controller must be uninstalled before installing AWS Load Balancer controller.
10-
Please follow our [migration guide](upgrade/migrate_v1_v2.md) to do migration.
16+
## Deployment Considerations
1117

12-
!!!note "Security updates"
13-
The controller doesn't receive security updates automatically. You need to manually upgrade to a newer version when it becomes available.
18+
### Additional Requirements for non-EKS clusters:
1419

15-
!!!note "non-EKS cluster"
16-
You can run the controller on a non-EKS cluster, for example kops or vanilla k8s. Here are the things to consider -
20+
* Ensure subnets are tagged appropriately for auto-discovery to work
21+
* For IP targets, pods must have IPs from the VPC subnets. You can configure `amazon-vpc-cni-k8s` plugin for this purpose.
1722

18-
- In lieu of IAM for service account, you will have to manually attach the IAM permissions to your worker nodes IAM roles
19-
- Ensure subnets are tagged appropriately for auto-discovery to work
20-
- For IP targets, pods must have IPs from the VPC subnets. You can configure `amazon-vpc-cni-k8s` plugin for this purpose.
23+
### Using metadata server version 2 (IMDSv2)
24+
If you are using the [IMDSv2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html) you must set the hop limit to 2 or higher in order to allow the AWS Load Balancer Controller to perform the metadata introspection.
2125

22-
!!!note "security group configuration"
23-
If you do not use `eksctl`, you need to ensure worker nodes security group permit access to TCP port 9443 from the kubernetes control plane for the webhook access.
26+
You can set the IMDSv2 hop limit as follows:
27+
```
28+
aws ec2 modify-instance-metadata-options --http-put-response-hop-limit 2 --region <region> --instance-id <instance-id>
29+
```
2430

25-
## Using metadata server version 2 (IMDSv2)
26-
If you are using the IMDSv2 you must set the hop limit to 2 or higher in order to allow the AWS Load Balancer Controller to perform the metadata introspection. Otherwise you have to manually specify the AWS region and the VPC via the controller flags `--aws-region` and `--aws-vpc-id`.
31+
Instead of depending on IMDSv2, you alternatively may specify the AWS region and the VPC via the controller flags `--aws-region` and `--aws-vpc-id`.
2732

33+
## Configure IAM
2834

29-
!!!tip
30-
You can set the IMDSv2 hop limit as follows:
31-
```
32-
aws ec2 modify-instance-metadata-options --http-put-response-hop-limit 2 --region <region> --instance-id <instance-id>
33-
```
35+
The controller runs on the worker nodes, so it needs access to the AWS ALB/NLB APIs via IAM permissions.
3436

35-
## IAM Permissions
37+
The IAM permissions can either be setup via [IAM roles for ServiceAccount (IRSA)](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-enable-IAM.html) or can be attached directly to the worker node IAM roles. If you are using kops or vanilla k8s, polices must be manually attached to node instances.
3638

37-
#### Setup IAM role for service accounts
38-
The controller runs on the worker nodes, so it needs access to the AWS ALB/NLB resources via IAM permissions.
39-
The IAM permissions can either be setup via IAM roles for ServiceAccount or can be attached directly to the worker node IAM roles.
39+
### Option A: IAM Roles for Service Accounts (IRSA)
4040

41-
!!!warning "Permissions with the least privileges"
42-
The reference IAM policies contain the following permissive configuration:
43-
```
44-
{
45-
"Effect": "Allow",
46-
"Action": [
47-
"ec2:AuthorizeSecurityGroupIngress",
48-
"ec2:RevokeSecurityGroupIngress"
49-
],
50-
"Resource": "*"
51-
},
52-
```
53-
We recommend to further scope down this configuration based on the VPC ID. Replace REGION, ACCOUNT and VPC-ID with appropriate values
54-
and add it to the above IAM permissions.
55-
```
56-
"Condition": {
57-
"ArnEquals": {
58-
"ec2:Vpc": "arn:aws:ec2:REGION:ACCOUNT:vpc/VPC-ID"
59-
}
41+
The reference IAM policies contain the following permissive configuration:
42+
```
43+
{
44+
"Effect": "Allow",
45+
"Action": [
46+
"ec2:AuthorizeSecurityGroupIngress",
47+
"ec2:RevokeSecurityGroupIngress"
48+
],
49+
"Resource": "*"
50+
},
51+
```
52+
53+
We recommend to further scope down this configuration based on the VPC ID or cluster name resource tag.
54+
55+
Example condition for VPC ID:
56+
```
57+
"Condition": {
58+
"ArnEquals": {
59+
"ec2:Vpc": "arn:aws:ec2:<REGION>:<ACCOUNT-ID>:vpc/<VPC-ID>"
6060
}
61-
```
62-
OR restrict access to the security groups tagged for the particular k8s cluster. Replace CLUSTER-NAME with the name of your k8s cluster and add it to the above IAM permissions.
63-
```
64-
"Condition": {
65-
"Null": {
66-
"aws:ResourceTag/kubernetes.io/cluster/CLUSTER-NAME": "false"
67-
}
61+
}
62+
```
63+
64+
Example condition for cluster name resource tag:
65+
```
66+
"Condition": {
67+
"Null": {
68+
"aws:ResourceTag/kubernetes.io/cluster/<CLUSTER-NAME>": "false"
6869
}
69-
```
70+
}
71+
```
7072

7173
1. Create IAM OIDC provider
7274
```
@@ -100,13 +102,14 @@ The IAM permissions can either be setup via IAM roles for ServiceAccount or can
100102
--region <region-code> \
101103
--approve
102104
```
103-
#### Setup IAM manually
105+
106+
### Option B: Attach IAM Policies to Nodes
104107
If not setting up IAM for ServiceAccount, apply the IAM policies from the following URL at minimum.
105108
```
106109
curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.2/docs/install/iam_policy.json
107110
```
108111
109-
##### IAM permission subset for those who use *TargetGroupBinding* only and don't plan to use the AWS Load Balancer Controller to manage security group rules:
112+
*IAM permission subset for those who use *TargetGroupBinding* only and don't plan to use the AWS Load Balancer Controller to manage security group rules:*
110113
111114
```
112115
{
@@ -130,13 +133,23 @@ curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-lo
130133
"Version": "2012-10-17"
131134
}
132135
```
136+
137+
138+
139+
## Network Configuration
140+
141+
Review the [worker nodes security group](https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html) docs. The node security group must permit incoming traffic on TCP port 9943 from the kubernetes control plane. This is needed for webhook access.
142+
143+
If you use [eksctl](https://eksctl.io/usage/vpc-networking/), this is the default configuration.
144+
133145
## Add Controller to Cluster
134146
135-
!!!note "Use Fargate"
136-
If you want to run the controller on Fargate, use Helm chart since it does not depend on the cert-manager.
147+
We recommend using the Helm chart. This supports Fargate and facilitates updating the controller.
137148
138149
=== "Via Helm"
139150
151+
If you want to run the controller on Fargate, use the Helm chart since it does not depend on the cert-manager.
152+
140153
### Detailed Instructions
141154
Follow the instructions in [aws-load-balancer-controller](https://github.com/aws/eks-charts/tree/master/stable/aws-load-balancer-controller) helm chart.
142155
@@ -147,21 +160,21 @@ curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-lo
147160
helm repo add eks https://aws.github.io/eks-charts
148161
```
149162
1. Install the TargetGroupBinding CRDs if upgrading the chart via `helm upgrade`.
163+
150164
```
151165
kubectl apply -k "github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master"
152166
```
153167
154168
!!!tip
155169
The `helm install` command automatically applies the CRDs, but `helm upgrade` doesn't.
156170
157-
!!!tip
158-
Only run one of the two following `helm install` commands depending on whether or not your cluster uses IAM roles for service accounts.
159171
160-
1. Install the helm chart if using IAM roles for service accounts. **NOTE** you need to specify both of the chart values `serviceAccount.create=false` and `serviceAccount.name=aws-load-balancer-controller`
172+
Helm command for clusters with IRSA:
161173
```
162174
helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=<cluster-name> --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller
163175
```
164-
1. Install the helm chart if **not** using IAM roles for service accounts
176+
177+
Helm command for clusters not using IRSA:
165178
```
166179
helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=<cluster-name>
167180
```
@@ -204,3 +217,9 @@ curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-lo
204217
```
205218
kubectl apply -f v2_4_1_full.yaml
206219
```
220+
221+
## Create Update Strategy
222+
223+
The controller doesn't receive security updates automatically. You need to manually upgrade to a newer version when it becomes available.
224+
225+
This can be done using [`helm upgrade`](https://helm.sh/docs/helm/helm_upgrade/) or another strategy to manage the controller deployment.

0 commit comments

Comments
 (0)