-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathazure-blueprint.yaml
592 lines (557 loc) · 21.2 KB
/
azure-blueprint.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
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
tosca_definitions_version: cloudify_dsl_1_3
description: >
This blueprint creates a Kubernetes Cluster.
It is based on this documentation: https://kubernetes.io/docs/getting-started-guides/kubeadm/
imports:
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-azure-plugin/1.4.3/plugin.yaml
- https://raw.githubusercontent.com/cloudify-incubator/cloudify-utilities-plugin/1.2.5/plugin.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-diamond-plugin/1.3.5/plugin.yaml
- https://raw.githubusercontent.com/cloudify-cosmo/cloudify-fabric-plugin/1.5/plugin.yaml
- types/kubernetes-types.yaml
- imports/kubernetes.yaml
inputs:
resource_prefix:
default: k8s
resource_suffix:
default: '0'
retry_after:
type: integer
default: 60
size:
default: Standard_A3
image:
default:
publisher: OpenLogic
offer: CentOS
sku: '7.3'
version: latest
agent_user:
description: The user name of the agent on the instance created from the image.
default: docker # currently this is required
ssh_public_keys:
description: the public key
default:
- path: {concat:[ '/home/', { get_input: agent_user }, '/.ssh/authorized_keys' ]}
keyData: { get_secret: agent_key_public }
encode_cloud_config:
default: true
dsl_definitions:
azure_config: &azure_config
subscription_id: { get_secret: subscription_id }
tenant_id: { get_secret: tenant_id }
client_id: { get_secret: client_id }
client_secret: { get_secret: client_secret }
node_templates:
kubernetes_master_docker:
type: cloudify.azure.nodes.compute.VirtualMachineExtension
properties:
location: { get_secret: location }
retry_after: { get_input: retry_after }
azure_config: *azure_config
interfaces:
cloudify.interfaces.lifecycle:
create:
inputs:
resource_config:
publisher: Microsoft.Azure.Extensions
type: CustomScript
typeHandlerVersion: '2.0'
autoUpgradeMinorVersion: true
settings:
commandToExecute:
concat:
- |
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
- |
yum -t -y install docker-1.12.6-28.git1398f24.el7.centos kubelet-1.6.4-0 kubeadm-1.6.4-0 kubectl-1.6.4-0 kubernetes-cni-0.5.1-0
systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet
relationships:
- type: cloudify.azure.relationships.vmx_contained_in_vm
target: kubernetes_master_host
kubernetes_node_docker:
type: cloudify.azure.nodes.compute.VirtualMachineExtension
properties:
location: { get_secret: location }
retry_after: { get_input: retry_after }
azure_config: *azure_config
interfaces:
cloudify.interfaces.lifecycle:
create:
inputs:
resource_config:
publisher: Microsoft.Azure.Extensions
type: CustomScript
typeHandlerVersion: '2.0'
autoUpgradeMinorVersion: true
settings:
commandToExecute:
concat:
- |
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
- |
yum -t -y install docker-1.12.6-28.git1398f24.el7.centos kubelet-1.6.4-0 kubeadm-1.6.4-0 kubectl-1.6.4-0 kubernetes-cni-0.5.1-0
systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet
mkdir -p /tmp/data
chmod a+rwtp /tmp/data
chcon -Rt svirt_sandbox_file_t /tmp/data
relationships:
- type: cloudify.azure.relationships.vmx_contained_in_vm
target: kubernetes_node_host
kubernetes_master_host:
type: cloudify.azure.nodes.compute.VirtualMachine
properties:
location: { get_secret: location }
retry_after: { get_input: retry_after }
os_family: linux
azure_config: *azure_config
resource_config:
hardwareProfile: {}
storageProfile: {}
osProfile: {}
agent_config:
user: { get_input: agent_user }
install_method: remote
port: 22
key: { get_secret: agent_key_private }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.connected_to_storage_account
target: storage_account
- type: cloudify.azure.relationships.connected_to_availability_set
target: availability_set
- type: cloudify.azure.relationships.connected_to_nic
target: kubernetes_master_host_nic
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: pkg.cloudify_azure.resources.compute.virtualmachine.create
inputs:
args:
hardwareProfile:
vmSize: { get_input: size }
storageProfile:
imageReference: { get_input: image}
osProfile:
adminUsername: { get_input: agent_user }
adminPassword: ''
# customData: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
linuxConfiguration:
ssh:
publicKeys: { get_input: ssh_public_keys }
disablePasswordAuthentication: true
kubernetes_node_host:
type: cloudify.azure.nodes.compute.VirtualMachine
properties:
location: { get_secret: location }
retry_after: { get_input: retry_after }
os_family: linux
azure_config: *azure_config
resource_config:
hardwareProfile: {}
storageProfile: {}
osProfile: {}
agent_config:
user: { get_input: agent_user }
install_method: remote
port: 22
key: { get_secret: agent_key_private }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.connected_to_storage_account
target: storage_account
- type: cloudify.azure.relationships.connected_to_availability_set
target: availability_set
- type: cloudify.azure.relationships.connected_to_nic
target: kubernetes_node_host_nic
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: pkg.cloudify_azure.resources.compute.virtualmachine.create
inputs:
args:
hardwareProfile:
vmSize: { get_input: size }
storageProfile:
imageReference: { get_input: image}
osProfile:
adminUsername: { get_input: agent_user }
adminPassword: ''
# customData: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
linuxConfiguration:
ssh:
publicKeys: { get_input: ssh_public_keys }
disablePasswordAuthentication: true
cloudify.interfaces.monitoring_agent:
install:
implementation: diamond.diamond_agent.tasks.install
inputs:
diamond_config:
interval: 1
start: diamond.diamond_agent.tasks.start
stop: diamond.diamond_agent.tasks.stop
uninstall: diamond.diamond_agent.tasks.uninstall
cloudify.interfaces.monitoring:
start:
implementation: diamond.diamond_agent.tasks.add_collectors
inputs:
collectors_config:
ProcessResourcesCollector:
config:
enabled: true
unit: B
measure_collector_time: true
cpu_interval: 0.5
process:
hyperkube:
name: hyperkube
network_security_group:
type: cloudify.azure.nodes.network.NetworkSecurityGroup
properties:
name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix}]}
location: { get_secret: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
securityRules:
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},ssh]}
properties:
description: SSH access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 22
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 102
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},udp]}
properties:
description: 53 UDP access
protocol: Udp
sourcePortRange: '*'
destinationPortRange: 53
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 103
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},tcp53]}
properties:
description: 53 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 53
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 104
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},http]}
properties:
description: HTTP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 80
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 105
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},https]}
properties:
description: HTTPS access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 443
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 106
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},2379tcp]}
properties:
description: 2379 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 2379
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 107
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},4001tcp]}
properties:
description: 4001 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 4001
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 108
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},4789tcp]}
properties:
description: 4789 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 4789
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1080
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6443tcp]}
properties:
description: 6443 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 6443
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 109
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6783tcp]}
properties:
description: 6783 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 6783
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1090
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6784tcp]}
properties:
description: 6784 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 6784
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1091
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6783udp]}
properties:
description: 6783 UDP access
protocol: Udp
sourcePortRange: '*'
destinationPortRange: 6783
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1092
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},6784udp]}
properties:
description: 6784 UDP access
protocol: Udp
sourcePortRange: '*'
destinationPortRange: 6784
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 1093
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},8000tcp]}
properties:
description: 8000 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 8000
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 110
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},http8080]}
properties:
description: 8080 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 8080
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 111
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},9090tcp]}
properties:
description: 9090 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 9090
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 112
access: Allow
direction: Inbound
- name: {concat:[{get_input: resource_prefix},nsg,{get_input: resource_suffix},10250tcp]}
properties:
description: 10250 TCP access
protocol: Tcp
sourcePortRange: '*'
destinationPortRange: 10250
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
priority: 113
access: Allow
direction: Inbound
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
availability_set:
type: cloudify.azure.nodes.compute.AvailabilitySet
properties:
name: {concat:[{get_input: resource_prefix},availset,{get_input: resource_suffix}]}
location: { get_secret: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
kubernetes_node_host_nic:
type: cloudify.azure.nodes.network.NetworkInterfaceCard
properties:
location: { get_secret: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.nic_connected_to_network_security_group
target: network_security_group
- type: cloudify.azure.relationships.nic_connected_to_ip_configuration
target: kubernetes_node_host_nic_ip_cfg
kubernetes_master_host_nic:
type: cloudify.azure.nodes.network.NetworkInterfaceCard
properties:
location: { get_secret: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.nic_connected_to_network_security_group
target: network_security_group
- type: cloudify.azure.relationships.nic_connected_to_ip_configuration
target: kubernetes_master_host_nic_ip_cfg
kubernetes_node_host_nic_ip_cfg:
type: cloudify.azure.nodes.network.IPConfiguration
properties:
location: { get_secret: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
privateIPAllocationMethod: Dynamic
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
- type: cloudify.azure.relationships.ip_configuration_connected_to_subnet
target: subnet
kubernetes_master_host_nic_ip_cfg:
type: cloudify.azure.nodes.network.IPConfiguration
properties:
location: { get_secret: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
privateIPAllocationMethod: Dynamic
relationships:
- type: cloudify.azure.relationships.ip_configuration_connected_to_subnet
target: subnet
- type: cloudify.azure.relationships.ip_configuration_connected_to_public_ip
target: kubernetes_master_ip
kubernetes_master_ip:
type: cloudify.azure.nodes.network.PublicIPAddress
properties:
location: { get_secret: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
publicIPAllocationMethod: Static
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
subnet:
type: cloudify.azure.nodes.network.Subnet
properties:
resource_group_name: { get_secret: mgr_resource_group_name }
name: { get_secret: mgr_subnet_name }
azure_config: *azure_config
use_external_resource: true
location: { get_secret: location }
relationships:
- type: cloudify.azure.relationships.contained_in_virtual_network
target: virtual_network
virtual_network:
type: cloudify.azure.nodes.network.VirtualNetwork
properties:
resource_group_name: { get_secret: mgr_resource_group_name }
name: { get_secret: mgr_virtual_network_name }
azure_config: *azure_config
use_external_resource: true
location: { get_secret: location }
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
storage_account:
type: cloudify.azure.nodes.storage.StorageAccount
properties:
location: { get_secret: location }
azure_config: *azure_config
retry_after: { get_input: retry_after }
resource_config:
accountType: Standard_LRS
relationships:
- type: cloudify.azure.relationships.contained_in_resource_group
target: resource_group
resource_group:
type: cloudify.azure.nodes.ResourceGroup
properties:
name: {concat:[{get_input: resource_prefix},arg,{get_input: resource_suffix}]}
location: { get_secret: location }
azure_config: *azure_config
groups:
k8s_node_scale_group:
members:
- kubernetes_node_host_nic_ip_cfg
- kubernetes_node_host_nic
- kubernetes_node_host
policies:
kubernetes_node_vms_scaling_policy:
type: cloudify.policies.scaling
properties:
default_instances: 1
targets: [k8s_node_scale_group]
outputs:
kubernetes_master_public_ip:
value: { get_attribute: [ kubernetes_master_host, public_ip ] }