This repository has been archived by the owner on Oct 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
corekube-metacloud.yaml
775 lines (710 loc) · 28.8 KB
/
corekube-metacloud.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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
heat_template_version: 2013-05-23
description: >
Deploy Kubernetes on a CoreOS cluster that operates on an
OpenStack Powered Cloud (Openstack IceHouse+ | Cisco Metacloud)
Maintainer - Chris Riviere <[email protected]> | GitHub @rivimont
Based on code originally written by Mike Metral <[email protected]> | Github: @metral for RackSpace OpenStack
Updated to use Neutron instead of Provider networks as well as most recent verions of CoreOS
parameters:
kubernetes_minion_count:
description: Number of CoreOS machines to deploy as Kubernetes Minion
type: number
default: 5
constraints:
- range:
min: 1
max: 12
description: Must be between 2 and 12 servers.
keyname:
type: string
description: Name of keypair to be used for compute instance
flavor:
type: string
default: m1.medium
constraints:
- allowed_values:
- m1.medium
- m1.large
- m1.xlarge
description: |
Must be a valid flavor
coreos_image:
type: string
description: CoreOS Image - currently 11
default: "CoreOS"
git_command:
type: string
description: Git repo checkout command
default: "/usr/bin/git clone https://github.com/metral/overlord ; /usr/bin/git -C overlord checkout -qf 199028526132ff9491d26c00b2fd9b9b9d7239a8"
flannel_url:
type: string
description: Flannel (0.5.5) Binary URL
default: "http://0afbabe78c1b1691fad4-21af6827a69c3ad910ccdb6595a59d19.r49.cf1.rackcdn.com/flanneld"
private_discovery_etcd_version:
type: string
description: Version of etcd used for Private Discovery node
default: "2.2.2"
discovery_net_interface:
type: string
description: Host network interface for which the Discovery node will operate over
default: "eth0"
kubernetes_net_interface:
type: string
description: Host network interface for which Kubernetes' overlay will operate over
default: "eth0"
timeout:
description: Wait condition timeout seconds
type: number
default: 600
floating-network-id:
type: string
label: Floating Network ID
description: UUID of the external network. The private network created by this stack will route to this network. Any floating IP addresses needed by this stack will also route to this network.
default: 82e6ce06-df85-4891-ad48-3af387b6180a
resources:
coreos_cluster_uuid:
type: OS::Heat::RandomString
stack_security:
type: OS::Neutron::SecurityGroup
properties:
name: "corekube"
rules:
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: 0
port_range_max: 65535
- remote_ip_prefix: 0.0.0.0/0
protocol: udp
port_range_min: 0
port_range_max: 65535
- remote_ip_prefix: 0.0.0.0/0
protocol: icmp
corekube_network:
type: OS::Neutron::Net
properties:
name: "corekube"
corekube_subnet:
type: OS::Neutron::Subnet
properties:
name: "corekube_subnet"
network_id:
get_resource: corekube_network
cidr: "10.10.10.0/24"
gateway_ip: "10.10.10.1"
allocation_pools: [{"start": "10.10.10.2", "end": "10.10.10.254"}]
dns_nameservers:
- 8.8.8.8
- 8.8.4.4
corekube_router:
type: OS::Neutron::Router
properties:
name: "corekube_router"
external_gateway_info:
enable_snat: true
network:
get_param: floating-network-id
corekube_router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id:
get_resource: corekube_router
subnet_id:
get_resource: corekube_subnet
discovery_wait_handle:
type: OS::Heat::WaitConditionHandle
discovery_wait_condition:
type: OS::Heat::WaitCondition
properties:
handle: { get_resource: discovery_wait_handle }
timeout: { get_param: timeout }
discovery_floatingip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id:
get_param: floating-network-id
discovery_port:
type: OS::Neutron::Port
properties:
security_groups:
- get_resource: stack_security
network_id:
get_resource: corekube_network
discovery_floatingip_association:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id:
get_resource: discovery_floatingip
port_id:
get_resource: discovery_port
discovery:
type: OS::Nova::Server
properties:
key_name: { get_param: keyname }
image: { get_param: coreos_image }
flavor: { get_param: flavor }
name: "discovery"
networks:
- port:
get_resource: discovery_port
user_data_format: RAW
config_drive: "true"
user_data:
str_replace:
template: |
#cloud-config
write_files:
- path: /run/get_discovery_interface_ip.sh
permissions: '0755'
content: |
#!/bin/bash
# Get's the IP of the interface that discovery will be
# accessible over
DISCOVERY_IF=%discovery_net_interface%
/usr/bin/ip -4 addr show $DISCOVERY_IF | /usr/bin/awk '/inet/ {print $2}' | /usr/bin/cut -d/ -f1 > /run/IP
/usr/bin/sed -i 's/^/IP=/' /run/IP
- path: /run/wcnotify.sh
permissions: '0755'
content: |
#!/bin/bash
%wc_notify% --data-binary '{"status": "SUCCESS"}'
coreos:
update:
group: stable
reboot-strategy: off
units:
- name: private-discovery-setup.service
command: start
content: |
[Unit]
After=network-online.target
Requires=network-online.target
[Service]
Type=forking
ExecStart=/usr/bin/bash /run/get_discovery_interface_ip.sh
- name: private-discovery.service
command: start
content: |
[Unit]
After=network-online.target private-discovery-setup.service
Requires=network-online.target private-discovery-setup.service
[Service]
EnvironmentFile=/run/IP
Restart=on-failure
RestartSec=5s
ExecStartPre=/usr/bin/docker pull quay.io/coreos/etcd:v%private_discovery_etcd_version%
ExecStart=/usr/bin/docker run -d --name discovery \
-p 2379:2379 -p 2380:2380 \
-v /usr/share/ca-certificates/:/etc/ssl/certs \
--net host quay.io/coreos/etcd:v%private_discovery_etcd_version% -name discovery \
-initial-advertise-peer-urls http://${IP}:2380,http://${IP}:7001 \
-listen-peer-urls http://${IP}:2380,http://${IP}:7001 \
-initial-cluster discovery=http://${IP}:2380,discovery=http://${IP}:7001 \
-advertise-client-urls http://${IP}:2379,http://${IP}:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001
- name: private-discovery-done.service
command: start
content: |
# Notifiy wait condition
[Unit]
After=network-online.target private-discovery.service
Requires=network-online.target private-discovery.service
[Service]
ExecStart=/run/wcnotify.sh
params:
"%wc_notify%": { get_attr: [discovery_wait_handle, curl_cli] }
"%discovery_net_interface%": { get_param: discovery_net_interface }
"%private_discovery_etcd_version%": { get_param: private_discovery_etcd_version}
overlord_wait_handle:
type: OS::Heat::WaitConditionHandle
overlord_wait_condition:
type: OS::Heat::WaitCondition
properties:
handle: {get_resource: overlord_wait_handle}
timeout: {get_param: timeout}
overlord_floatingip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id:
get_param: floating-network-id
overlord_port:
type: OS::Neutron::Port
properties:
security_groups:
- get_resource: stack_security
network_id:
get_resource: corekube_network
overlord_floatingip_association:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id:
get_resource: overlord_floatingip
port_id:
get_resource: overlord_port
overlord:
type: OS::Nova::Server
properties:
key_name: { get_param: keyname }
image: { get_param: coreos_image }
flavor: { get_param: flavor }
name: "overlord"
networks:
- port:
get_resource: overlord_port
user_data_format: RAW
config_drive: "true"
user_data:
str_replace:
template: |
#cloud-config
write_files:
- path: /run/wcnotify.sh
permissions: '0755'
content: |
#!/bin/bash
%wc_notify% --data-binary '{"status": "SUCCESS"}'
- path: /run/setup_etcd_cloudinit_conf.sh
permissions: '0755'
content: |
#!/bin/bash
ENV="/etc/environment"
# Test for RW access to $1
touch $ENV
if [ $? -ne 0 ]; then
echo exiting, unable to modify: $ENV
exit 1
fi
# Setup environment target
sed -i -e '/^COREOS_PUBLIC_IPV4=/d' \
-e '/^COREOS_PRIVATE_IPV4=/d' \
"${ENV}"
# We spin loop until the the IP addresses are set
function get_ip () {
IF=$1
IP=
while [ 1 ]; do
IP=$(ifconfig $IF | awk '/inet / {print $2}')
if [ "$IP" != "" ]; then
break
fi
sleep .1
done
echo $IP
}
# Echo results of IP queries to environment file as soon as network interfaces
# get assigned IPs
echo COREOS_PUBLIC_IPV4=$(get_ip eth0) >> $ENV # Also assigned to same IP
echo COREOS_PRIVATE_IPV4=$(get_ip eth0) >> $ENV #eno1 should be changed to your device name
A=`cat /etc/environment | grep COREOS_PRIVATE_IPV4 | cut -f2 -d "="`
sed -i "s#=:#=${A}:#g" /run/systemd/system/etcd.service.d/20-cloudinit.conf
systemctl daemon-reload
coreos:
etcd:
name: overlord
discovery: http://%discovery%:2379/v2/keys/discovery/%uuid%
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
update:
group: stable
reboot-strategy: off
units:
- name: setup-etcd-cloudinit-conf.service
command: start
runtime: true
content: |
[Unit]
Description=Setup environment with private (and public) IP addresses
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/run/setup_etcd_cloudinit_conf.sh
- name: etcd.service
command: start
- name: fleet.socket
command: start
content: |
[Socket]
# Talk to the API over a Unix domain socket (default)
ListenStream=/var/run/fleet.sock
# Talk to the API over an exposed port
ListenStream=10001
Service=fleet-local.service
[Install]
WantedBy=sockets.target
- name: fleet-local.service
command: start
content: |
# fleet-local is kicked off by fleet.socket after API port
# is opened
[Unit]
Description=fleet-local
Wants=etcd.service
Requires=etcd.service
[Service]
Environment=FLEET_PUBLIC_IP=$private_ipv4
Environment=FLEET_METADATA=kubernetes_role=overlord
ExecStart=/usr/bin/fleet
Restart=always
RestartSec=10s
- name: overlord.service
command: start
content: |
# Overlord / logic layer service to deploy kubernetes to
# the cluster
[Unit]
After=network-online.target etcd.service
Requires=network-online.target etcd.service
[Service]
WorkingDirectory=/root
Environment="DIR=overlord"
ExecStartPre=/usr/bin/rm -rf $DIR
ExecStartPre=%git_command%
ExecStart=/usr/bin/bash ${DIR}/build_run.sh
- name: overlord-done.service
command: start
content: |
# Notifiy wait condition
[Unit]
After=network-online.target overlord.service
Requires=network-online.target overlord.service
[Service]
ExecStart=/run/wcnotify.sh
params:
"%discovery%": { get_attr: [discovery, networks, corekube, 0] }
"%uuid%": { get_attr: [coreos_cluster_uuid, value] }
"%git_command%": { get_param: git_command }
"%wc_notify%": { get_attr: [overlord_wait_handle, curl_cli] }
kubernetes_master_floatingip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id:
get_param: floating-network-id
kubernetes_master_port:
type: OS::Neutron::Port
properties:
security_groups:
- get_resource: stack_security
network_id:
get_resource: corekube_network
kubernetes_master_floatingip_association:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id:
get_resource: kubernetes_master_floatingip
port_id:
get_resource: kubernetes_master_port
kubernetes_master:
type: OS::Nova::Server
properties:
key_name: { get_param: keyname }
image: { get_param: coreos_image }
flavor: { get_param: flavor }
name: "kubernetes_master"
networks:
- port:
get_resource: kubernetes_master_port
user_data_format: RAW
config_drive: "true"
user_data:
str_replace:
template: |
#cloud-config
write_files:
- path: /run/setup_etcd_cloudinit_conf.sh
permissions: '0755'
content: |
#!/bin/bash
ENV="/etc/environment"
# Test for RW access to $1
touch $ENV
if [ $? -ne 0 ]; then
echo exiting, unable to modify: $ENV
exit 1
fi
# Setup environment target
sed -i -e '/^COREOS_PUBLIC_IPV4=/d' \
-e '/^COREOS_PRIVATE_IPV4=/d' \
"${ENV}"
# We spin loop until the the IP addresses are set
function get_ip () {
IF=$1
IP=
while [ 1 ]; do
IP=$(ifconfig $IF | awk '/inet / {print $2}')
if [ "$IP" != "" ]; then
break
fi
sleep .1
done
echo $IP
}
# Echo results of IP queries to environment file as soon as network interfaces
# get assigned IPs
echo COREOS_PUBLIC_IPV4=$(get_ip eth0) >> $ENV # Also assigned to same IP
echo COREOS_PRIVATE_IPV4=$(get_ip eth0) >> $ENV #eno1 should be changed to your device name
A=`cat /etc/environment | grep COREOS_PRIVATE_IPV4 | cut -f2 -d "="`
sed -i "s#=:#=${A}:#g" /run/systemd/system/etcd.service.d/20-cloudinit.conf
systemctl daemon-reload
- path: /run/get_discovery_ip_port.sh
permissions: '0755'
content: |
#!/bin/bash
# Sets up environment file with the discovery node's IP &
# port so # that in Overlode's template
# [email protected] it can be passed
# in as an argument
/usr/bin/cat /run/systemd/system/etcd.service.d/20-cloudinit.conf | /usr/bin/grep -i discovery | /usr/bin/cut -f3 -d"=" | /usr/bin/awk -F '/v' '{print $1}' > /run/discovery_ip_port
/usr/bin/sed -i 's/^/DISCOVERY_IP_PORT=/' /run/discovery_ip_port
coreos:
etcd:
name: kubernetes_master
discovery: http://%discovery%:2379/v2/keys/discovery/%uuid%
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $private_ipv4
metadata: kubernetes_role=master
update:
group: stable
reboot-strategy: off
units:
- name: setup-etcd-cloudinit-conf.service
command: start
runtime: true
content: |
[Unit]
Description=Setup environment with private (and public) IP addresses
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/run/setup_etcd_cloudinit_conf.sh
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: get_discovery_ip_port.service
command: start
runtime: true
content: |
# Runs get_discovery_ip_port.sh to have discovery IP &
# port ready for consumption by overlord when creating
# the Kubernetes' [email protected] template
[Unit]
After=network-online.target
Requires=network-online.target
[Service]
ExecStart=/usr/bin/bash /run/get_discovery_ip_port.sh
- name: flannel-install.service
command: start
content: |
# Installs flannel
[Unit]
After=network-online.target
Requires=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/wget -N -P /opt/bin %flannel_url%
ExecStart=/usr/bin/chmod +x /opt/bin/flanneld
- name: flannel.service
command: start
content: |
# Configures & starts flannel
[Unit]
After=network-online.target etcd.service flannel-install.service
Requires=network-online.target etcd.service flannel-install.service
[Service]
ExecStartPre=/usr/bin/etcdctl --endpoint=%discovery%:4001 mk /coreos.com/network/config '{"Network":"10.244.0.0/15", "Backend": {"Type": "vxlan"}}'
ExecStart=/opt/bin/flanneld -etcd-endpoints=http://%discovery%:4001 -iface=%kubernetes_net_interface%
Restart=always
RestartSec=5s
- name: flannel-env.path
command: start
content: |
# Ensures flannel env vars are set to use with Docker
[Path]
PathExists=/run/flannel/subnet.env
Unit=docker.service
- name: docker.service
command: start
content: |
# Starts new docker server that uses flannel
[Unit]
After=flannel-env.path network-online.target flannel.service
Requires=flannel-env.path network-online.target flannel.service
Description=Docker Application Container Engine
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStartPre=/usr/bin/systemctl kill docker.service
ExecStart=/usr/bin/docker daemon --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
[Install]
WantedBy=multi-user.target
- name: generate-k8s-certs.service
command: start
content: |
[Unit]
Description=Generate Kubernetes API Server certificates
ConditionPathExists=!/srv/kubernetes/.certs.lock
Requires=network-online.target
After=network-online.target
[Service]
Type=oneshot
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/sbin/groupadd -r kube-cert
ExecStartPre=/usr/bin/wget -q -N -P /opt/bin https://gist.githubusercontent.com/metral/0731466d7b35d4020dfd/raw/2fb0c5858e5eaefdf6b45b9492f1d6c75a7815b0/make-ca-cert.sh
ExecStartPre=/usr/bin/chmod u=rwx,go= /opt/bin/make-ca-cert.sh
ExecStart=/opt/bin/make-ca-cert.sh ${COREOS_PRIVATE_IPV4} IP:10.1.0.1,DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.freeletics.local
ExecStart=/opt/bin/make-ca-cert.sh ${COREOS_PRIVATE_IPV4} IP:10.1.0.1,IP:127.0.0.1,DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.freeletics.local,DNS:localhost
RemainAfterExit=true
params:
"%discovery%": { get_attr: [discovery, networks, corekube, 0] }
"%uuid%": { get_attr: [coreos_cluster_uuid, value] }
"%flannel_url%": { get_param: flannel_url }
"%kubernetes_net_interface%": { get_param: kubernetes_net_interface }
kubernetes_minions:
type: "OS::Heat::ResourceGroup"
properties:
count: { get_param: kubernetes_minion_count }
resource_def:
type: OS::Nova::Server
properties:
key_name: { get_param: keyname }
image: { get_param: coreos_image }
flavor: { get_param: flavor }
name: kubernetes_minion_%index%
networks:
- network: { get_resource: corekube_network }
security_groups:
- get_resource: stack_security
user_data_format: RAW
config_drive: "true"
user_data:
str_replace:
template: |
#cloud-config
write_files:
- path: /run/setup_etcd_cloudinit_conf.sh
permissions: '0755'
content: |
#!/bin/bash
ENV="/etc/environment"
# Test for RW access to $1
touch $ENV
if [ $? -ne 0 ]; then
echo exiting, unable to modify: $ENV
exit 1
fi
# Setup environment target
sed -i -e '/^COREOS_PUBLIC_IPV4=/d' \
-e '/^COREOS_PRIVATE_IPV4=/d' \
"${ENV}"
# We spin loop until the the IP addresses are set
function get_ip () {
IF=$1
IP=
while [ 1 ]; do
IP=$(ifconfig $IF | awk '/inet / {print $2}')
if [ "$IP" != "" ]; then
break
fi
sleep .1
done
echo $IP
}
# Echo results of IP queries to environment file as soon as network interfaces
# get assigned IPs
echo COREOS_PUBLIC_IPV4=$(get_ip eth0) >> $ENV # Also assigned to same IP
echo COREOS_PRIVATE_IPV4=$(get_ip eth0) >> $ENV #eno1 should be changed to your device name
A=`cat /etc/environment | grep COREOS_PRIVATE_IPV4 | cut -f2 -d "="`
sed -i "s#=:#=${A}:#g" /run/systemd/system/etcd.service.d/20-cloudinit.conf
systemctl daemon-reload
coreos:
etcd:
name: kubernetes_minion_%index%
discovery: http://%discovery%:2379/v2/keys/discovery/%uuid%
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $private_ipv4
metadata: kubernetes_role=minion
update:
group: stable
reboot-strategy: off
units:
- name: setup-etcd-cloudinit-conf.service
command: start
runtime: true
content: |
[Unit]
Description=Setup environment with private (and public) IP addresses
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/run/setup_etcd_cloudinit_conf.sh
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: flannel-install.service
command: start
content: |
# Installs flannel
[Unit]
After=network-online.target
Requires=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/wget -N -P /opt/bin %flannel_url%
ExecStart=/usr/bin/chmod +x /opt/bin/flanneld
- name: flannel.service
command: start
content: |
# Configures & starts flannel
[Unit]
After=etcd.service flannel-install.service
Requires=etcd.service flannel-install.service
[Service]
ExecStart=/opt/bin/flanneld -etcd-endpoints=http://%discovery%:4001 -iface=%kubernetes_net_interface%
Restart=always
RestartSec=5s
- name: flannel-env.path
command: start
content: |
# Ensures flannel env vars are set to use with Docker
[Path]
PathExists=/run/flannel/subnet.env
Unit=docker.service
- name: docker.service
command: start
content: |
# Starts new docker server that uses flannel
[Unit]
After=flannel-env.path network-online.target flannel.service
Requires=flannel-env.path network-online.target flannel.service
Description=Docker Application Container Engine
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStartPre=/usr/bin/systemctl kill docker.service
ExecStart=/usr/bin/docker daemon --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
[Install]
WantedBy=multi-user.target
params:
"%discovery%": { get_attr: [discovery, networks, corekube, 0] }
"%uuid%": { get_attr: [coreos_cluster_uuid, value] }
"%flannel_url%": { get_param: flannel_url }
"%kubernetes_net_interface%": { get_param: kubernetes_net_interface }
outputs:
discovery_ip:
value: { get_attr: [ discovery, first_address ] }
description: The IP of the Discovery
overlord_ip:
value: { get_attr: [ overlord, first_address ] }
description: The IP of the Overlord
master_ip:
value: { get_attr: [ kubernetes_master, first_address ] }
description: The IP of the Kubernetes Master
minion_ips:
value: { get_attr: [ kubernetes_minions, first_address ] }
description: The IP of the Kubernetes Minions