-
Notifications
You must be signed in to change notification settings - Fork 0
/
eks-nodegroup.yml
78 lines (69 loc) · 2.1 KB
/
eks-nodegroup.yml
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
AWSTemplateFormatVersion: 2010-09-09
Description:
EKS managed node group
Parameters:
EnvironmentName:
Type: String
NodeMin:
Type: String
NodeMax:
Type: String
NodeDesired:
Type: String
NodeInstanceType:
Type: String
Label:
Type: String
KeyName:
Type: "AWS::EC2::KeyPair::KeyName"
Description: The EC2 Key Pair to allow SSH access to the instances
Resources:
#----- EKS Node group -----#
EKSNodegroup:
Type: 'AWS::EKS::Nodegroup'
Properties:
ClusterName:
!ImportValue
'Fn::Sub': '${EnvironmentName}-eks-cluster'
NodeRole:
!ImportValue
'Fn::Sub': '${EnvironmentName}-eks-node-role'
NodegroupName: !Sub ${EnvironmentName}-eks-${Label}-node-group
ScalingConfig:
MinSize: !Ref NodeMin
DesiredSize: !Ref NodeDesired
MaxSize: !Ref NodeMax
Labels:
Name: !Ref Label
# Need to use DefaultVersionNumber instead of LatestVersion. Limitation in CF when using launch templates
LaunchTemplate:
Id: !Ref EKSLaunchTemplate
Version: !GetAtt EKSLaunchTemplate.DefaultVersionNumber
Subnets:
- !ImportValue
'Fn::Sub': '${EnvironmentName}-eks-subnet1'
- !ImportValue
'Fn::Sub': '${EnvironmentName}-eks-subnet2'
EKSLaunchTemplate:
Type: 'AWS::EC2::LaunchTemplate'
Properties:
LaunchTemplateName: !Sub ${EnvironmentName}-eks-${Label}-launch-template
LaunchTemplateData:
BlockDeviceMappings:
- DeviceName: "/dev/xvda"
Ebs:
DeleteOnTermination: true
Encrypted: true
VolumeType: "gp2"
VolumeSize: 20
InstanceType: !Ref NodeInstanceType
KeyName: !Ref KeyName
TagSpecifications:
- ResourceType: instance
Tags:
- Key: "Name"
Value: !Sub ${EnvironmentName}-eks-node
- ResourceType: volume
Tags:
- Key: "Name"
Value: !Sub ${EnvironmentName}-eks-node