forked from cratekube/cratekube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplatform-cluster.yaml
174 lines (174 loc) · 4.94 KB
/
platform-cluster.yaml
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
AWSTemplateFormatVersion: "2010-09-09"
Description: "AWS CloudFormation template for the CrateKube bootstrap POC"
Parameters:
Keyname:
Description: "Name of an existing EC2 KeyPair to enable SSH access to the instances"
Type: "String"
MinLength: "1"
MaxLength: "64"
AllowedPattern: "[-_ a-zA-Z0-9]*"
ConstraintDescription: "can contain only alphanumeric characters, spaces, dashes and underscores"
Mappings:
RegionMap:
af-south-1:
HVM64: ami-04402e3da3a7a5357
eu-north-1:
HVM64: ami-00ace2399b9d2b103
ap-south-1:
HVM64: ami-0d0e74761b4cc8a53
eu-west-3:
HVM64: ami-02840369a939ae502
eu-west-2:
HVM64: ami-066f0ae194916c572
eu-south-1:
HVM64: ami-0150ade5ec13519e2
eu-west-1:
HVM64: ami-09266271a2521d06f
ap-northeast-2:
HVM64: ami-062022418ff822030
me-south-1:
HVM64: ami-01c838c68451ec0dc
ap-northeast-1:
HVM64: ami-032b1a02e6610214e
sa-east-1:
HVM64: ami-0cbe40dd412e5ef32
ca-central-1:
HVM64: ami-05e77f4fec44e91f3
ap-east-1:
HVM64: ami-067e77c5d74f989a7
ap-southeast-1:
HVM64: ami-0fa00d20cc2fa3c81
ap-southeast-2:
HVM64: ami-064db566f79006111
eu-central-1:
HVM64: ami-0e9347664c1c5ed65
us-east-1:
HVM64: ami-09edd32d9b0990d49
us-east-2:
HVM64: ami-008c5ba1857e0fdec
us-west-1:
HVM64: ami-02649d71054b25d22
us-west-2:
HVM64: ami-023578bcb54b36edf
Resources:
VPC:
Type: "AWS::EC2::VPC"
Properties:
CidrBlock: "10.0.0.0/16"
EnableDnsSupport: true
EnableDnsHostnames: true
InstanceTenancy: "default"
Subnet:
Type: "AWS::EC2::Subnet"
Properties:
VpcId: !Ref VPC
CidrBlock: "10.0.1.0/24"
MapPublicIpOnLaunch: true
InternetGateway:
Type: "AWS::EC2::InternetGateway"
IGAttachment:
Type: "AWS::EC2::VPCGatewayAttachment"
Properties:
VpcId: !Ref VPC
InternetGatewayId: !Ref InternetGateway
RouteTable:
Type: "AWS::EC2::RouteTable"
Properties:
VpcId: !Ref VPC
Route:
Type: "AWS::EC2::Route"
Properties:
RouteTableId: !Ref RouteTable
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref InternetGateway
SubnetRtAssociation:
Type: "AWS::EC2::SubnetRouteTableAssociation"
Properties:
RouteTableId: !Ref RouteTable
SubnetId: !Ref Subnet
SshSecurityGroup:
Type: "AWS::EC2::SecurityGroup"
Properties:
VpcId: !Ref VPC
GroupDescription: 'security group for ssh access'
SecurityGroupEgress:
FromPort: 0
ToPort: 0
IpProtocol: -1
CidrIp: "0.0.0.0/0"
SecurityGroupIngress:
- FromPort: 22
ToPort: 22
IpProtocol: "tcp"
CidrIp: "0.0.0.0/0"
- FromPort: 10250
ToPort: 10250
IpProtocol: "tcp"
CidrIp: "0.0.0.0/0"
- FromPort: 2379
ToPort: 2379
IpProtocol: "tcp"
CidrIp: "0.0.0.0/0"
- FromPort: 6443
ToPort: 6443
IpProtocol: "tcp"
CidrIp: "0.0.0.0/0"
MasterInstance:
Type: "AWS::EC2::Instance"
Metadata:
AWS::CloudFormation::Init:
config:
services:
sysvinit:
docker:
enabled: "true"
ensureRunning: "true"
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", HVM64]
InstanceType: "t3.large"
SubnetId: !Ref Subnet
SecurityGroupIds: [!Ref SshSecurityGroup]
KeyName: !Ref Keyname
UserData:
"Fn::Base64":
!Sub |
#!/bin/bash -xe
yum install -y aws-cfn-bootstrap
/opt/aws/bin/cfn-init --stack ${AWS::StackName} --resource MasterInstance --region ${AWS::Region}
/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource MasterInstance --region ${AWS::Region}
CreationPolicy:
ResourceSignal:
Timeout: PT4M
WorkerInstance:
Type: "AWS::EC2::Instance"
Metadata:
AWS::CloudFormation::Init:
config:
services:
sysvinit:
docker:
enabled: "true"
ensureRunning: "true"
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", HVM64]
InstanceType: "t3.large"
SubnetId: !Ref Subnet
SecurityGroupIds: [!Ref SshSecurityGroup]
KeyName: !Ref Keyname
UserData:
"Fn::Base64":
!Sub |
#!/bin/bash -xe
yum install -y aws-cfn-bootstrap
/opt/aws/bin/cfn-init --stack ${AWS::StackName} --resource WorkerInstance --region ${AWS::Region}
/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource WorkerInstance --region ${AWS::Region}
CreationPolicy:
ResourceSignal:
Timeout: PT4M
Outputs:
MasterNodeDNS:
Description: "master node host dns"
Value: !GetAtt MasterInstance.PublicDnsName
WorkerNodeDNS:
Description: "worker node host dns"
Value: !GetAtt WorkerInstance.PublicDnsName