forked from serhiicherepanov/kubernetes-coreos-do
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloud-config-node.yml
More file actions
150 lines (146 loc) · 4.46 KB
/
cloud-config-node.yml
File metadata and controls
150 lines (146 loc) · 4.46 KB
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
#cloud-config
---
write_files:
- path: /opt/etc/kubernetes-version
permissions: 0644
owner: root
content: "v0.18.2" # change it to actual release
- path: /opt/bin/downloader.sh
permissions: 0744
owner: root
content: |
#!/usr/bin/bash
version=$(cat /opt/etc/kubernetes-version)
if [ ! -z ${1} ] && [ ! -z ${2} ]; then
if [ ! -d ${1} ]; then
/usr/bin/mkdir -p ${1}
fi
/usr/bin/wget -N -P ${1} https://storage.googleapis.com/kubernetes-release/release/${version}/bin/linux/amd64/${2}
/usr/bin/chmod +x ${1}/${2}
fi
- path: /opt/bin/kubelet-service.sh
owner: root
permissions: 0744
content: |
#!/usr/bin/bash
ip=$(ip addr | grep inet | grep eth1 | grep global | awk '{print $2}' | sed -e 's/\/.*$//')
/opt/bin/kubelet \
--address=0.0.0.0 \
--port=10250 \
--hostname_override=${ip} \
--api_servers=%MASTER_IP%:8080
- path: "/opt/bin/register-node.sh"
owner: root
permissions: 0744
content: |
#!/bin/bash
ip=$(ip addr | grep inet | grep eth1 | grep global | awk '{print $2}' | sed -e 's/\/.*$//')
name=$(hostname)
curl -X POST -d @- http://${1}/api/v1beta1/nodes << EOF
{
"id": "${ip}",
"kind": "Minion",
"apiVersion": "v1beta1",
"resources": {
"capacity": {
"cpu": 1000,
"memory": 1073741824
}
},
"externalID": "${ip}",
"labels": {
"name": "${name}"
}
}
EOF
coreos:
fleet:
etcd-servers: http://%MASTER_IP%:4001
metadata: "role=node"
flannel:
interface: eth1
etcd_endpoints: http://%MASTER_IP%:4001
units:
- name: etcd.service
mask: true
- name: fleet.service
command: start
- name: flanneld.service
command: start
drop-ins:
- name: 50-network-config.conf
content: |
[Unit]
Requires=network-online.target
After=network-online.target
- name: setup-network-environment.service
command: start
content: |
[Unit]
Description=Setup Network Environment
Documentation=https://github.com/kelseyhightower/setup-network-environment
Requires=network-online.target
After=network-online.target
[Service]
ExecStartPre=/usr/bin/mkdir -p /opt/bin
ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/k8s/setup-network-environment
ExecStartPre=/usr/bin/chmod +x /opt/bin/setup-network-environment
ExecStart=/opt/bin/setup-network-environment
RemainAfterExit=yes
Type=oneshot
- name: docker.service
command: start
drop-ins:
- name: 51-docker-mirror.conf
content: |
[Unit]
# making sure that flanneld finished startup, otherwise containers
# won't land in flannel's network...
Requires=flanneld.service
After=flanneld.service
[Service]
Environment=DOCKER_OPTS='--registry-mirror=http://%MASTER_IP%:5000'
- name: kube-proxy.service
command: start
content: |
[Unit]
Description=Kubernetes Proxy
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Requires=setup-network-environment.service
After=setup-network-environment.service
[Service]
ExecStartPre=/opt/bin/downloader.sh /opt/bin kube-proxy
ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-proxy
ExecStart=/opt/bin/kube-proxy \
--master=%MASTER_IP%:8080 \
--logtostderr=true
Restart=always
RestartSec=10
- name: kube-kubelet.service
command: start
content: |
[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Requires=setup-network-environment.service
After=setup-network-environment.service
[Service]
EnvironmentFile=/etc/network-environment
ExecStartPre=/opt/bin/downloader.sh /opt/bin kubelet
ExecStart=/opt/bin/kubelet-service.sh
Restart=always
RestartSec=10
- name: register-node.service
command: start
content: |
[Unit]
Description=Register Node on Master
Requires=kube-kubelet.service
After=kube-kubelet.service
[Service]
ExecStart=/opt/bin/register-node.sh %MASTER_IP%:8080
RemainAfterExit=yes
Type=oneshot
update:
group: stable
reboot-strategy: off