awslabs.eks-mcp-server 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,454 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Description: 'Amazon EKS Auto Mode Cluster with dedicated VPC - Private and Public subnets'
3
+
4
+ Parameters:
5
+ ClusterName:
6
+ Type: String
7
+ Description: Name of the EKS cluster
8
+ Default: eks-cluster
9
+
10
+ KubernetesVersion:
11
+ Type: String
12
+ Description: Kubernetes version to use for the EKS cluster
13
+ Default: 1.32
14
+ AllowedValues:
15
+ - 1.28
16
+ - 1.29
17
+ - 1.30
18
+ - 1.31
19
+ - 1.32
20
+
21
+ VpcBlock:
22
+ Type: String
23
+ Default: 192.168.0.0/16
24
+ Description: The CIDR range for the VPC. This should be a valid private (RFC 1918) CIDR range.
25
+
26
+ PublicSubnet01Block:
27
+ Type: String
28
+ Default: 192.168.0.0/18
29
+ Description: CidrBlock for public subnet 01 within the VPC
30
+
31
+ PublicSubnet02Block:
32
+ Type: String
33
+ Default: 192.168.64.0/18
34
+ Description: CidrBlock for public subnet 02 within the VPC
35
+
36
+ PrivateSubnet01Block:
37
+ Type: String
38
+ Default: 192.168.128.0/18
39
+ Description: CidrBlock for private subnet 01 within the VPC
40
+
41
+ PrivateSubnet02Block:
42
+ Type: String
43
+ Default: 192.168.192.0/18
44
+ Description: CidrBlock for private subnet 02 within the VPC
45
+
46
+ Metadata:
47
+ AWS::CloudFormation::Interface:
48
+ ParameterGroups:
49
+ - Label:
50
+ default: "EKS Cluster Configuration"
51
+ Parameters:
52
+ - ClusterName
53
+ - KubernetesVersion
54
+ - Label:
55
+ default: "Worker Network Configuration"
56
+ Parameters:
57
+ - VpcBlock
58
+ - PublicSubnet01Block
59
+ - PublicSubnet02Block
60
+ - PrivateSubnet01Block
61
+ - PrivateSubnet02Block
62
+
63
+ Resources:
64
+ # VPC Resources
65
+ VPC:
66
+ Type: AWS::EC2::VPC
67
+ Properties:
68
+ CidrBlock:
69
+ Ref: VpcBlock
70
+ EnableDnsSupport: true
71
+ EnableDnsHostnames: true
72
+ Tags:
73
+ - Key: Name
74
+ Value:
75
+ Fn::Sub: '${AWS::StackName}-VPC'
76
+
77
+ InternetGateway:
78
+ Type: "AWS::EC2::InternetGateway"
79
+
80
+ VPCGatewayAttachment:
81
+ Type: "AWS::EC2::VPCGatewayAttachment"
82
+ Properties:
83
+ InternetGatewayId:
84
+ Ref: InternetGateway
85
+ VpcId:
86
+ Ref: VPC
87
+
88
+ PublicRouteTable:
89
+ Type: AWS::EC2::RouteTable
90
+ Properties:
91
+ VpcId:
92
+ Ref: VPC
93
+ Tags:
94
+ - Key: Name
95
+ Value: Public Subnets
96
+ - Key: Network
97
+ Value: Public
98
+
99
+ PrivateRouteTable01:
100
+ Type: AWS::EC2::RouteTable
101
+ Properties:
102
+ VpcId:
103
+ Ref: VPC
104
+ Tags:
105
+ - Key: Name
106
+ Value: Private Subnet AZ1
107
+ - Key: Network
108
+ Value: Private01
109
+
110
+ PrivateRouteTable02:
111
+ Type: AWS::EC2::RouteTable
112
+ Properties:
113
+ VpcId:
114
+ Ref: VPC
115
+ Tags:
116
+ - Key: Name
117
+ Value: Private Subnet AZ2
118
+ - Key: Network
119
+ Value: Private02
120
+
121
+ PublicRoute:
122
+ DependsOn: VPCGatewayAttachment
123
+ Type: AWS::EC2::Route
124
+ Properties:
125
+ RouteTableId:
126
+ Ref: PublicRouteTable
127
+ DestinationCidrBlock: 0.0.0.0/0
128
+ GatewayId:
129
+ Ref: InternetGateway
130
+
131
+ PrivateRoute01:
132
+ DependsOn:
133
+ - VPCGatewayAttachment
134
+ - NatGateway01
135
+ Type: AWS::EC2::Route
136
+ Properties:
137
+ RouteTableId:
138
+ Ref: PrivateRouteTable01
139
+ DestinationCidrBlock: 0.0.0.0/0
140
+ NatGatewayId:
141
+ Ref: NatGateway01
142
+
143
+ PrivateRoute02:
144
+ DependsOn:
145
+ - VPCGatewayAttachment
146
+ - NatGateway02
147
+ Type: AWS::EC2::Route
148
+ Properties:
149
+ RouteTableId:
150
+ Ref: PrivateRouteTable02
151
+ DestinationCidrBlock: 0.0.0.0/0
152
+ NatGatewayId:
153
+ Ref: NatGateway02
154
+
155
+ NatGateway01:
156
+ DependsOn:
157
+ - NatGatewayEIP1
158
+ - PublicSubnet01
159
+ - VPCGatewayAttachment
160
+ Type: AWS::EC2::NatGateway
161
+ Properties:
162
+ AllocationId:
163
+ Fn::GetAtt: 'NatGatewayEIP1.AllocationId'
164
+ SubnetId:
165
+ Ref: PublicSubnet01
166
+ Tags:
167
+ - Key: Name
168
+ Value:
169
+ Fn::Sub: '${AWS::StackName}-NatGatewayAZ1'
170
+
171
+ NatGateway02:
172
+ DependsOn:
173
+ - NatGatewayEIP2
174
+ - PublicSubnet02
175
+ - VPCGatewayAttachment
176
+ Type: AWS::EC2::NatGateway
177
+ Properties:
178
+ AllocationId:
179
+ Fn::GetAtt: 'NatGatewayEIP2.AllocationId'
180
+ SubnetId:
181
+ Ref: PublicSubnet02
182
+ Tags:
183
+ - Key: Name
184
+ Value:
185
+ Fn::Sub: '${AWS::StackName}-NatGatewayAZ2'
186
+
187
+ NatGatewayEIP1:
188
+ DependsOn:
189
+ - VPCGatewayAttachment
190
+ Type: 'AWS::EC2::EIP'
191
+ Properties:
192
+ Domain: vpc
193
+
194
+ NatGatewayEIP2:
195
+ DependsOn:
196
+ - VPCGatewayAttachment
197
+ Type: 'AWS::EC2::EIP'
198
+ Properties:
199
+ Domain: vpc
200
+
201
+ PublicSubnet01:
202
+ Type: AWS::EC2::Subnet
203
+ Metadata:
204
+ Comment: Subnet 01
205
+ Properties:
206
+ MapPublicIpOnLaunch: true
207
+ AvailabilityZone:
208
+ Fn::Select:
209
+ - '0'
210
+ - Fn::GetAZs:
211
+ Ref: AWS::Region
212
+ CidrBlock:
213
+ Ref: PublicSubnet01Block
214
+ VpcId:
215
+ Ref: VPC
216
+ Tags:
217
+ - Key: Name
218
+ Value:
219
+ Fn::Sub: "${AWS::StackName}-PublicSubnet01"
220
+ - Key: kubernetes.io/role/elb
221
+ Value: 1
222
+
223
+ PublicSubnet02:
224
+ Type: AWS::EC2::Subnet
225
+ Metadata:
226
+ Comment: Subnet 02
227
+ Properties:
228
+ MapPublicIpOnLaunch: true
229
+ AvailabilityZone:
230
+ Fn::Select:
231
+ - '1'
232
+ - Fn::GetAZs:
233
+ Ref: AWS::Region
234
+ CidrBlock:
235
+ Ref: PublicSubnet02Block
236
+ VpcId:
237
+ Ref: VPC
238
+ Tags:
239
+ - Key: Name
240
+ Value:
241
+ Fn::Sub: "${AWS::StackName}-PublicSubnet02"
242
+ - Key: kubernetes.io/role/elb
243
+ Value: 1
244
+
245
+ PrivateSubnet01:
246
+ Type: AWS::EC2::Subnet
247
+ Metadata:
248
+ Comment: Subnet 03
249
+ Properties:
250
+ AvailabilityZone:
251
+ Fn::Select:
252
+ - '0'
253
+ - Fn::GetAZs:
254
+ Ref: AWS::Region
255
+ CidrBlock:
256
+ Ref: PrivateSubnet01Block
257
+ VpcId:
258
+ Ref: VPC
259
+ Tags:
260
+ - Key: Name
261
+ Value:
262
+ Fn::Sub: "${AWS::StackName}-PrivateSubnet01"
263
+ - Key: kubernetes.io/role/internal-elb
264
+ Value: 1
265
+
266
+ PrivateSubnet02:
267
+ Type: AWS::EC2::Subnet
268
+ Metadata:
269
+ Comment: Private Subnet 02
270
+ Properties:
271
+ AvailabilityZone:
272
+ Fn::Select:
273
+ - '1'
274
+ - Fn::GetAZs:
275
+ Ref: AWS::Region
276
+ CidrBlock:
277
+ Ref: PrivateSubnet02Block
278
+ VpcId:
279
+ Ref: VPC
280
+ Tags:
281
+ - Key: Name
282
+ Value:
283
+ Fn::Sub: "${AWS::StackName}-PrivateSubnet02"
284
+ - Key: kubernetes.io/role/internal-elb
285
+ Value: 1
286
+
287
+ PublicSubnet01RouteTableAssociation:
288
+ Type: AWS::EC2::SubnetRouteTableAssociation
289
+ Properties:
290
+ SubnetId:
291
+ Ref: PublicSubnet01
292
+ RouteTableId:
293
+ Ref: PublicRouteTable
294
+
295
+ PublicSubnet02RouteTableAssociation:
296
+ Type: AWS::EC2::SubnetRouteTableAssociation
297
+ Properties:
298
+ SubnetId:
299
+ Ref: PublicSubnet02
300
+ RouteTableId:
301
+ Ref: PublicRouteTable
302
+
303
+ PrivateSubnet01RouteTableAssociation:
304
+ Type: AWS::EC2::SubnetRouteTableAssociation
305
+ Properties:
306
+ SubnetId:
307
+ Ref: PrivateSubnet01
308
+ RouteTableId:
309
+ Ref: PrivateRouteTable01
310
+
311
+ PrivateSubnet02RouteTableAssociation:
312
+ Type: AWS::EC2::SubnetRouteTableAssociation
313
+ Properties:
314
+ SubnetId:
315
+ Ref: PrivateSubnet02
316
+ RouteTableId:
317
+ Ref: PrivateRouteTable02
318
+
319
+ ControlPlaneSecurityGroup:
320
+ Type: AWS::EC2::SecurityGroup
321
+ Properties:
322
+ GroupDescription: Cluster communication with worker nodes
323
+ VpcId:
324
+ Ref: VPC
325
+
326
+ # EKS Cluster IAM Role with required policies for Auto Mode
327
+ EksClusterRole:
328
+ Type: AWS::IAM::Role
329
+ Properties:
330
+ AssumeRolePolicyDocument:
331
+ Version: '2012-10-17'
332
+ Statement:
333
+ - Effect: Allow
334
+ Principal:
335
+ Service:
336
+ - eks.amazonaws.com
337
+ Action:
338
+ - sts:AssumeRole
339
+ - sts:TagSession
340
+ ManagedPolicyArns:
341
+ - arn:aws:iam::aws:policy/AmazonEKSClusterPolicy
342
+ - arn:aws:iam::aws:policy/AmazonEKSComputePolicy
343
+ - arn:aws:iam::aws:policy/AmazonEKSBlockStoragePolicy
344
+ - arn:aws:iam::aws:policy/AmazonEKSLoadBalancingPolicy
345
+ - arn:aws:iam::aws:policy/AmazonEKSNetworkingPolicy
346
+
347
+ # Node IAM Role with required policies for Auto Mode
348
+ NodeInstanceRole:
349
+ Type: AWS::IAM::Role
350
+ Properties:
351
+ AssumeRolePolicyDocument:
352
+ Version: '2012-10-17'
353
+ Statement:
354
+ - Effect: Allow
355
+ Principal:
356
+ Service:
357
+ - ec2.amazonaws.com
358
+ Action:
359
+ - sts:AssumeRole
360
+ ManagedPolicyArns:
361
+ - arn:aws:iam::aws:policy/AmazonEKSWorkerNodeMinimalPolicy
362
+ - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPullOnly
363
+ Path: /
364
+
365
+ # EKS Auto Mode Cluster
366
+ EksCluster:
367
+ Type: AWS::EKS::Cluster
368
+ Metadata:
369
+ checkov:
370
+ skip:
371
+ - id: CKV_AWS_58
372
+ comment: "Secrets encryption is enabled by default in EKS 1.27+"
373
+ Properties:
374
+ Name:
375
+ Ref: ClusterName
376
+ Version:
377
+ Ref: KubernetesVersion
378
+ RoleArn:
379
+ Fn::GetAtt: EksClusterRole.Arn
380
+ ResourcesVpcConfig:
381
+ SecurityGroupIds:
382
+ - Ref: ControlPlaneSecurityGroup
383
+ SubnetIds:
384
+ - Ref: PublicSubnet01
385
+ - Ref: PublicSubnet02
386
+ - Ref: PrivateSubnet01
387
+ - Ref: PrivateSubnet02
388
+ EndpointPublicAccess: true
389
+ EndpointPrivateAccess: true
390
+ # Auto Mode Configuration
391
+ ComputeConfig:
392
+ Enabled: true
393
+ NodeRoleArn:
394
+ Fn::GetAtt: NodeInstanceRole.Arn
395
+ NodePools:
396
+ - general-purpose
397
+ - system
398
+ KubernetesNetworkConfig:
399
+ ElasticLoadBalancing:
400
+ Enabled: true
401
+ StorageConfig:
402
+ BlockStorage:
403
+ Enabled: true
404
+ AccessConfig:
405
+ AuthenticationMode: API
406
+ DependsOn: [EksClusterRole, NodeInstanceRole, PublicSubnet01, PublicSubnet02, PrivateSubnet01, PrivateSubnet02]
407
+
408
+ Outputs:
409
+ SubnetIds:
410
+ Description: Subnets IDs in the VPC
411
+ Value:
412
+ Fn::Join:
413
+ - ","
414
+ - - Ref: PublicSubnet01
415
+ - Ref: PublicSubnet02
416
+ - Ref: PrivateSubnet01
417
+ - Ref: PrivateSubnet02
418
+
419
+ SecurityGroups:
420
+ Description: Security group for the cluster control plane communication with worker nodes
421
+ Value:
422
+ Fn::Join:
423
+ - ","
424
+ - - Ref: ControlPlaneSecurityGroup
425
+
426
+ VpcId:
427
+ Description: The VPC Id
428
+ Value:
429
+ Ref: VPC
430
+
431
+ ClusterName:
432
+ Description: The name of the EKS cluster
433
+ Value:
434
+ Ref: EksCluster
435
+
436
+ ClusterArn:
437
+ Description: The ARN of the EKS cluster
438
+ Value:
439
+ Fn::GetAtt: EksCluster.Arn
440
+
441
+ ClusterEndpoint:
442
+ Description: The endpoint for the EKS cluster
443
+ Value:
444
+ Fn::GetAtt: EksCluster.Endpoint
445
+
446
+ ClusterSecurityGroupId:
447
+ Description: Security group for the cluster control plane communication with worker nodes
448
+ Value:
449
+ Fn::GetAtt: EksCluster.ClusterSecurityGroupId
450
+
451
+ NodeInstanceRoleArn:
452
+ Description: The node instance role ARN
453
+ Value:
454
+ Fn::GetAtt: NodeInstanceRole.Arn
@@ -0,0 +1,49 @@
1
+ # Kubernetes Deployment template for ECR images
2
+ apiVersion: apps/v1
3
+ kind: Deployment
4
+ metadata:
5
+ name: APP_NAME
6
+ namespace: NAMESPACE
7
+ annotations:
8
+ checkov.io/skip1: CKV_K8S_20=This is a template file with placeholders, security context will be configured by the user
9
+ checkov.io/skip2: CKV_K8S_31=Seccomp profile will be configured by the user based on their specific requirements
10
+ checkov.io/skip3: CKV_K8S_23=Non-root user will be configured by the user based on their application needs
11
+ checkov.io/skip4: CKV_K8S_9=Readiness probe will be added by the user based on their application health check requirements
12
+ checkov.io/skip5: CKV_K8S_38=Service account token mounting will be configured by the user as needed
13
+ checkov.io/skip6: CKV_K8S_14=This is a template with IMAGE_URI placeholder, actual image tag will be provided by the user
14
+ checkov.io/skip7: CKV_K8S_43=This is a template with IMAGE_URI placeholder, actual image tag will be provided by the user
15
+ checkov.io/skip8: CKV_K8S_8=Liveness probe will be added by the user based on their application health check requirements
16
+ checkov.io/skip9: CKV_K8S_37=Container capabilities will be configured by the user based on their security requirements
17
+ checkov.io/skip10: CKV_K8S_29=Security context is partially configured with capabilities, full context will be added by the user
18
+ checkov.io/skip11: CKV_K8S_22=Read-only filesystem will be configured by the user based on their application requirements
19
+ checkov.io/skip12: CKV_K8S_40=UID will be configured by the user based on their security requirements
20
+ checkov.io/skip13: CKV2_K8S_6=NetworkPolicy will be configured by the user based on their network security requirements
21
+ labels:
22
+ app.kubernetes.io/name: APP_NAME
23
+ spec:
24
+ replicas: REPLICAS
25
+ selector:
26
+ matchLabels:
27
+ app.kubernetes.io/name: APP_NAME
28
+ template:
29
+ metadata:
30
+ labels:
31
+ app.kubernetes.io/name: APP_NAME
32
+ spec:
33
+ containers:
34
+ - name: APP_NAME
35
+ image: IMAGE_URI
36
+ imagePullPolicy: Always
37
+ ports:
38
+ - containerPort: PORT
39
+ securityContext:
40
+ capabilities:
41
+ drop:
42
+ - NET_RAW
43
+ resources:
44
+ requests:
45
+ cpu: CPU
46
+ memory: MEMORY
47
+ limits:
48
+ cpu: CPU
49
+ memory: MEMORY
@@ -0,0 +1,18 @@
1
+ # Kubernetes Service template for LoadBalancer services
2
+ apiVersion: v1
3
+ kind: Service
4
+ metadata:
5
+ name: APP_NAME
6
+ namespace: NAMESPACE
7
+ labels:
8
+ app.kubernetes.io/name: APP_NAME
9
+ annotations:
10
+ service.beta.kubernetes.io/aws-load-balancer-scheme: LOAD_BALANCER_SCHEME
11
+ spec:
12
+ type: LoadBalancer
13
+ ports:
14
+ - port: PORT
15
+ targetPort: PORT
16
+ protocol: TCP
17
+ selector:
18
+ app.kubernetes.io/name: APP_NAME