-
Notifications
You must be signed in to change notification settings - Fork 35
/
existing-vpc-docker-single-rancher.yml
281 lines (277 loc) · 9.82 KB
/
existing-vpc-docker-single-rancher.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
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 单节点Docker部署Rancher,管理多集群K8s,混合云+本地中心,确保安全,加速数字化,配置ECS实例与安全组访问。
en: Deploying Rancher on a single-node Docker setup to manage multiple Kubernetes
(K8s) clusters across hybrid cloud and on-premises data centers, ensuring security,
accelerating digital transformation, with configuration of ECS instances and security
group access.
Parameters:
VSwitchZoneId:
Type: String
Label:
en: VSwitch Availability Zone
zh-cn: 交换机可用区
Description:
en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please
confirm that the Availability Zone supports the specification of creating
ECS resources,which is recommended to be different from other VSwitch Availability
Zone</font></b>
zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
VPC:
Type: String
Label:
en: Existing VPC Instance ID
zh-cn: 现有VPC的实例ID
Description:
en: Please search the ID starts with (vpc-xxx)from console-Virtual Private Cloud
zh-cn: 现有虚拟专有网络的实例ID,控制台-VPC-专有网络下查询
AssociationProperty: ALIYUN::ECS::VPC::VPCId
VSwitch:
Type: String
Label:
en: Existing VSwitch ID
zh-cn: 网络交换机ID
Description:
en: Please search the business VSwitch ID starts with(vsw-xxx)from console-Virtual
Private Cloud-VSwitches
zh-cn: 现有业务网络交换机的实例ID,控制台-VPC-专有网络-交换机下查询
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
SecurityGroup:
Type: String
Label:
en: Business Security Group ID
zh-cn: 业务安全组ID
Description:
en: Please search the business security group ID starting with(sg-xxx)from console-ECS-Network
& Security
zh-cn: 现有业务安全组的实例ID,控制台-ECS-网络与安全-安全组下查询
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例规格
Description:
en: 'Fill in the specifications that can be used under the VSwitch availability
zone;</b></font><br>general specifications:<font color=''red''><b>ecs.c5.large</b></font><br>note:
a few zones do not support general specifications<br>see detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html''
target=''_blank''><b><font color=''blue''>Instance Specification Family</font></a></b>'
zh-cn: 填写VSwitch可用区下可使用的规格;<br>通用规格:<font color='red'><b>ecs.c5.large</b></font><br>注:可用区可能不支持通用规格<br>规格详见:<a
href='https://help.aliyun.com/document_detail/25378.html' target='_blank'><b><font
color='blue'>实例规格族</font></a></b>
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: VSwitchZoneId
SystemDiskCategory:
Type: String
Label:
en: System Disk Type
zh-cn: 系统盘类型
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency:
<font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD
Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud:
<font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local
SSD Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>可选值:</b></font><br>[cloud_efficiency: <font
color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd:
<font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]<br>[ephemeral_ssd:
<font color=''green''>本地SSD盘</font>]'
Default: cloud_efficiency
AllowedValues:
- cloud_efficiency
- cloud_ssd
- cloud
- cloud_essd
- ephemeral_ssd
SystemDiskSize:
Type: Number
Label:
en: System Disk Space
zh-cn: 系统盘空间
Description:
en: 'System disk size, range of values: 20-500, units: GB.'
zh-cn: 系统盘大小, 取值范围:[20, 500], 单位:GB。
Default: 20
RancherLocalDataPath:
Type: String
Label:
en: The Rancher service's etcd persistent data local storage directory.
zh-cn: Rancher的Etcd持久化数据本地存储目录
Description:
en: 'The Rancher service''s etcd persistent data local storage directory.;<br>The
default address: <font color=''red''><b>/opt/rancher</b></font>'
zh-cn: Rancher的Etcd持久化数据本地存储目录;<br>默认地址:<font color='red'><b>/opt/rancher</b></font>
Default: /opt/rancher
Password:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: Server login password, Length 8-30, must contain three(Capital letters,
lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol
in).
zh-cn: 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
ConstraintDescription:
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers,
()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
MinLength: 8
MaxLength: 30
NoEcho: true
Resources:
RancherServer:
Type: ALIYUN::ECS::InstanceGroup
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId: centos_7
AllocatePublicIP: true
InstanceName: RancherServer
InstanceType:
Ref: InstanceType
MaxAmount: 1
Password:
Ref: Password
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskSize:
Ref: SystemDiskSize
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- WaitConditionHandle
- CurlCli
- Fn::Join:
- ''
- - '#!/bin/sh'
- " \n"
- RancherLocalDataPath=
- Ref: RancherLocalDataPath
- '
'
- "InstallDocker() { \n"
- " yum install -y yum-utils \n"
- " yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo\
\ stable-19.03 \n"
- " yum makecache fast \n"
- " yum -y install docker-ce-19.03.8 \n"
- " systemctl enable docker \n"
- " systemctl start docker \n"
- "} \n"
- '
'
- "StartRancher() { \n"
- " mkdir -p ${RancherLocalDataPath} \n"
- " docker run -d --restart=unless-stopped -p 80:80 -p 443:443 -v ${RancherLocalDataPath}:/var/lib/rancher\
\ --privileged rancher/rancher:latest \n"
- "} \n"
- '
'
- "main() { \n"
- " InstallDocker \n"
- " StartRancher \n"
- "} \n"
- '
'
- "main \n"
- "netstat -ntlp | grep 80 >> /tmp/access.log \n"
- "if [[ $? -eq 0 ]]; \n"
- "then \n"
- " ros-notify \n"
- "fi \n"
Metadata:
ALIYUN::ROS::Designer:
id: 11509317-9c81-4f5f-b6dd-95f245e2e081
WaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: dbc3f31b-5b01-4f1f-8895-735eeace4591
WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: WaitConditionHandle
Timeout: 1800
Metadata:
ALIYUN::ROS::Designer:
id: 69de9d16-d3f1-4ecc-8f4a-e26dcd2bfbdb
Outputs:
RancherServerWebUrl:
Value:
Fn::Sub:
- http://${RancherServerAddress}
- RancherServerAddress:
Fn::Select:
- '0'
- Fn::GetAtt:
- RancherServer
- PublicIps
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VSwitchZoneId
- VPC
- VSwitch
- SecurityGroup
Label:
default:
en: Infrastructure Configuration
zh-cn: 基础资源配置(必填)
- Parameters:
- InstanceType
- SystemDiskCategory
- SystemDiskSize
- RancherLocalDataPath
- Password
Label:
default:
en: Rancher Configuration
zh-cn: Rancher 配置
TemplateTags:
- acs:example:容器:Rancher单机版(已有VPC)
ALIYUN::ROS::Designer:
11509317-9c81-4f5f-b6dd-95f245e2e081:
position:
x: -54
y: 91
size:
height: 60
width: 60
z: 0
69de9d16-d3f1-4ecc-8f4a-e26dcd2bfbdb:
position:
x: 60
y: 10
size:
height: 60
width: 60
z: 0
9c850689-ee70-4f53-a327-6ddb3427890b:
source:
id: 69de9d16-d3f1-4ecc-8f4a-e26dcd2bfbdb
target:
id: dbc3f31b-5b01-4f1f-8895-735eeace4591
z: 1
dbc3f31b-5b01-4f1f-8895-735eeace4591:
position:
x: 60
y: 190
size:
height: 60
width: 60
z: 0