-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkubeadm_install.sh
executable file
·290 lines (157 loc) · 5.48 KB
/
kubeadm_install.sh
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
#!/bin/bash
CNI_PLUGINS_VERSION="v1.1.2"
ARCH="amd64"
DEST="/opt/cni/bin"
sudo mkdir -p "$DEST"
#curl -L "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-#plugins-linux-${ARCH}-${CNI_PLUGINS_VERSION}.tgz" | sudo tar -C "$DEST" -xz
DOWNLOAD_DIR="/usr/local/bin"
sudo mkdir -p "$DOWNLOAD_DIR"
CRICTL_VERSION="v1.27.0"
ARCH="amd64"
curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-${ARCH}.tar.gz" | sudo tar -C $DOWNLOAD_DIR -xz
RELEASE="$(curl -sSL https://dl.k8s.io/release/stable.txt)"
ARCH="amd64"
pushd $DOWNLOAD_DIR
sudo curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/${ARCH}/{kubectl,kubeadm,kubelet}
sudo chmod +x {kubectl,kubeadm,kubelet}
popd
RELEASE_VERSION="v0.4.0"
sudo rm -rf /etc/systemd/system/kubelet.service
sudo mkdir -p /etc/systemd/system/kubelet.service.d
cat kubeadm.conf | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
# Apply sysctl params without reboot
sudo sysctl --system
CONTAINERD_VERSION="1.7.1"
wget --no-check-certificate https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-linux-amd64.tar.gz
tar Cxzvf /usr/local containerd-${CONTAINERD_VERSION}-linux-amd64.tar.gz
cp containerd.service /usr/lib/systemd/system/
#pushd /usr/lib/systemd/system
#wget --no-check-certificate https://raw.githubusercontent.com/containerd/containerd/main/#containerd.service
#popd
systemctl daemon-reload
systemctl enable --now containerd
RUNC_VERSION="1.1.7"
CNI_PLUGINS="1.3.0"
wget --no-check-certificate https://github.com/opencontainers/runc/releases/download/v${RUNC_VERSION}/runc.amd64
install -m 755 runc.amd64 /usr/local/sbin/runc
wget --no-check-certificate https://github.com/containernetworking/plugins/releases/download/v${CNI_PLUGINS}/cni-plugins-linux-amd64-v${CNI_PLUGINS}.tgz
mkdir -p /opt/cni/bin
tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v${CNI_PLUGINS}.tgz
git clone https://git.netfilter.org/libnetfilter_cttimeout/
pushd libnetfilter_cttimeout
autoreconf -i
./configure
make
make install
popd
git clone https://git.netfilter.org/libnetfilter_cthelper/
pushd libnetfilter_cthelper
autoreconf -i
./configure
make
make install
popd
git clone https://git.netfilter.org/libnetfilter_queue/
pushd libnetfilter_queue
autoreconf -i
./configure
make
make install
popd
git clone https://git.netfilter.org/libnetfilter_log/
pushd libnetfilter_log
autoreconf -i
./configure
make
make install
popd
git clone https://git.netfilter.org/libnetfilter_acct/
pushd libnetfilter_acct
autoreconf -i
./configure
make
make install
popd
git clone https://git.netfilter.org/libnfnetlink/
pushd libnfnetlink
autoreconf -i
./configure
make
make install
popd
git clone https://git.netfilter.org/libnftnl/
pushd libnftnl
autoreconf -i
./configure
make
make install
popd
CONNTRACK_VERSION="1.4.7"
SOCAT_VERSION="1.7.4.4"
ASCIDOC_VERSION="3.2.3"
wget --no-check-certificate https://www.netfilter.org/projects/conntrack-tools/files/conntrack-tools-${CONNTRACK_VERSION}.tar.bz2 && tar xvf conntrack-tools-${CONNTRACK_VERSION}.tar.bz2
pushd conntrack-tools-${CONNTRACK_VERSION}
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure -enable-systemd
make
make install
popd
wget --no-check-certificate http://www.dest-unreach.org/socat/download/socat-${SOCAT_VERSION}.tar.gz && tar -xvzf socat-${SOCAT_VERSION}.tar.gz
pushd socat-${SOCAT_VERSION}
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure -enable-systemd
make
make install
popd
git clone git://git.netfilter.org/iptables
pushd iptables
./autogen.sh
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --enable-libipq --enable-bpf-compiler --enable-nfsynproxy --enable-profiling --enable-static --enable-devel
make
make install
popd
mkdir -p asciidoc3-${ASCIDOC_VERSION}
python3 -m ensurepip
python3 -m pip install virtualenv
python3 -m venv ascii_venv
chmod +x ascii_venv/bin/activate
./ascii_venv/bin/activate
pushd asciidoc3-${ASCIDOC_VERSION}
wget https://asciidoc3.org/asciidoc3-${ASCIDOC_VERSION}.tar.gz && tar -xvzf asciidoc3-${ASCIDOC_VERSION}.tar.gz
./installscript
popd
#git clone git://git.netfilter.org/nftables
#pushd nftables
#
#./autogen.sh
#
#PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --enable-libipq --enable-bpf-compiler --enable-nfsynproxy --enable-profiling --enable-static --enable-devel
#
#make
#
#make install
#
#popd
echo "Writing kubelet"
cat kubelet.service | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service
echo "Reading the file"
cat /etc/systemd/system/kubelet.service
echo "Finished displaying the kubelet.service file"
systemctl enable --now kubelet
mkdir -p /etc/containerd
containerd config default > /etc/containerd/config.toml
chmod +x systemd_cgroup.py
cat /etc/containerd/config.toml | ./systemd_cgroup.py | tee /etc/containerd/config.toml
chmod +x kubelet_substitution.py
cat /etc/systemd/system/kubelet.service | ./kubelet_substitution.py | tee /etc/systemd/system/kubelet.service
systemctl enable --now containerd