forked from branyangeks/eks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheks-alb-controller.yaml
More file actions
257 lines (256 loc) · 8.79 KB
/
eks-alb-controller.yaml
File metadata and controls
257 lines (256 loc) · 8.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
AWSTemplateFormatVersion: "2010-09-09"
Description: "Deploys the alb load balancer controller to an existing kubernetes cluster (qs-1qnl6p00n)"
Metadata:
QSLint:
Exclusions: [W9002, W9003, W9004, W9006]
Parameters:
OIDCIssuerURLWithoutProtocol:
Type: String
ClusterName:
Type: String
Resources:
ALBIngressIAMRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument: !Sub |
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::${AWS::AccountId}:oidc-provider/${OIDCIssuerURLWithoutProtocol}"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"${OIDCIssuerURLWithoutProtocol}:sub": "system:serviceaccount:kube-system:alb-load-balancer-controller"
}
}
}
]
}
Policies:
- PolicyName: alb-ingress-policy
PolicyDocument:
Statement:
- Effect: Allow
Action:
- acm:DescribeCertificate
- acm:ListCertificates
- acm:GetCertificate
Resource: "*"
- Effect: Allow
Action:
- ec2:AuthorizeSecurityGroupIngress
- ec2:CreateSecurityGroup
- ec2:CreateTags
- ec2:DeleteTags
- ec2:DeleteSecurityGroup
- ec2:DescribeAccountAttributes
- ec2:DescribeAddresses
- ec2:DescribeInstances
- ec2:DescribeInstanceStatus
- ec2:DescribeInternetGateways
- ec2:DescribeNetworkInterfaces
- ec2:DescribeSecurityGroups
- ec2:DescribeSubnets
- ec2:DescribeTags
- ec2:DescribeVpcs
- ec2:ModifyInstanceAttribute
- ec2:ModifyNetworkInterfaceAttribute
- ec2:RevokeSecurityGroupIngress
Resource: "*"
- Effect: Allow
Action:
- elasticloadbalancing:AddListenerCertificates
- elasticloadbalancing:AddTags
- elasticloadbalancing:CreateListener
- elasticloadbalancing:CreateLoadBalancer
- elasticloadbalancing:CreateRule
- elasticloadbalancing:CreateTargetGroup
- elasticloadbalancing:DeleteListener
- elasticloadbalancing:DeleteLoadBalancer
- elasticloadbalancing:DeleteRule
- elasticloadbalancing:DeleteTargetGroup
- elasticloadbalancing:DeregisterTargets
- elasticloadbalancing:DescribeListenerCertificates
- elasticloadbalancing:DescribeListeners
- elasticloadbalancing:DescribeLoadBalancers
- elasticloadbalancing:DescribeLoadBalancerAttributes
- elasticloadbalancing:DescribeRules
- elasticloadbalancing:DescribeSSLPolicies
- elasticloadbalancing:DescribeTags
- elasticloadbalancing:DescribeTargetGroups
- elasticloadbalancing:DescribeTargetGroupAttributes
- elasticloadbalancing:DescribeTargetHealth
- elasticloadbalancing:ModifyListener
- elasticloadbalancing:ModifyLoadBalancerAttributes
- elasticloadbalancing:ModifyRule
- elasticloadbalancing:ModifyTargetGroup
- elasticloadbalancing:ModifyTargetGroupAttributes
- elasticloadbalancing:RegisterTargets
- elasticloadbalancing:RemoveListenerCertificates
- elasticloadbalancing:RemoveTags
- elasticloadbalancing:SetIpAddressType
- elasticloadbalancing:SetSecurityGroups
- elasticloadbalancing:SetSubnets
- elasticloadbalancing:SetWebACL
Resource: "*"
- Effect: Allow
Action:
- iam:CreateServiceLinkedRole
- iam:GetServerCertificate
- iam:ListServerCertificates
Resource: "*"
- Effect: Allow
Action:
- waf-regional:GetWebACLForResource
- waf-regional:GetWebACL
- waf-regional:AssociateWebACL
- waf-regional:DisassociateWebACL
Resource: "*"
- Effect: Allow
Action:
- tag:GetResources
- tag:TagResources
Resource: "*"
- Effect: Allow
Action:
- waf:GetWebACL
Resource: "*"
- Effect: Allow
Action:
- wafv2:GetWebACL
- wafv2:GetWebACLForResource
- wafv2:AssociateWebACL
- wafv2:DisassociateWebACL
Resource: "*"
- Effect: Allow
Action:
- shield:DescribeProtection
- shield:GetSubscriptionState
- shield:DeleteProtection
- shield:CreateProtection
- shield:DescribeSubscription
- shield:ListProtections
Resource: "*"
Path: "/"
ALBClusterRole:
Type: "Custom::KubeManifest"
Version: '1.0'
Properties:
ServiceToken: !Sub "arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:EKS-QuickStart-KubeManifest-${ClusterName}"
ClusterName: !Ref ClusterName
Manifest:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: alb-load-balancer-controller
name: alb-load-balancer-controller
rules:
- apiGroups:
- ""
- extensions
resources:
- configmaps
- endpoints
- events
- ingresses
- ingresses/status
- services
verbs:
- create
- get
- list
- update
- watch
- patch
- apiGroups:
- ""
- extensions
resources:
- nodes
- pods
- secrets
- services
- namespaces
verbs:
- get
- list
- watch
ALBClusterRoleBinding:
Type: "Custom::KubeManifest"
Version: '1.0'
DependsOn:
- ALBClusterRole
- ALBServiceAccount
Properties:
ServiceToken: !Sub "arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:EKS-QuickStart-KubeManifest-${ClusterName}"
ClusterName: !Ref ClusterName
Manifest:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/name: alb-load-balancer-controller
name: alb-load-balancer-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: alb-load-balancer-controller
subjects:
- kind: ServiceAccount
name: alb-load-balancer-controller
namespace: kube-system
ALBServiceAccount:
Type: "Custom::KubeManifest"
Version: '1.0'
Properties:
ServiceToken: !Sub "arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:EKS-QuickStart-KubeManifest-${ClusterName}"
ClusterName: !Ref ClusterName
Manifest:
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: alb-load-balancer-controller
annotations:
eks.amazonaws.com/role-arn: !GetAtt ALBIngressIAMRole.Arn
name: alb-load-balancer-controller
namespace: kube-system
ALBDeployment:
Type: "Custom::KubeManifest"
Version: '1.0'
DependsOn: ALBServiceAccount
Properties:
ServiceToken: !Sub "arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:EKS-QuickStart-KubeManifest-${ClusterName}"
ClusterName: !Ref ClusterName
Manifest:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: alb-load-balancer-controller
name: alb-load-balancer-controller
namespace: kube-system
spec:
selector:
matchLabels:
app.kubernetes.io/name: alb-load-balancer-controller
template:
metadata:
labels:
app.kubernetes.io/name: alb-load-balancer-controller
spec:
containers:
- name: alb-load-balancer-controller
args:
- --ingress-class=alb
- !Sub "--cluster-name=${ClusterName}"
image: docker.io/amazon/aws-alb-ingress-controller:v2.1.1
serviceAccountName: alb-load-balancer-controller
Outputs:
ALBDeployment:
Value: !Ref ALBDeployment