-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathinit-master.sh
38 lines (31 loc) · 1.34 KB
/
init-master.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
#!/bin/sh
# Give reachable IP as an argument for this script
echo "Publick IP, that will be advertised is: ${1}"
sudo bash -c 'apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update'
sudo apt-get install -y --allow-unauthenticated docker-engine
sudo apt-get install -y --allow-unauthenticated kubelet kubeadm kubectl kubernetes-cni
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl enable docker && systemctl start docker
sudo systemctl enable kubelet && systemctl start kubelet
echo 'You might need to reboot / relogin to make docker work correctly'
for file in /etc/systemd/system/kubelet.service.d/*-kubeadm.conf
do
echo "Found ${file}"
FILE_NAME=$file
done
echo "Chosen ${FILE_NAME} as kubeadm.conf"
sudo sed -i '/^ExecStart=\/usr\/bin\/kubelet/ s/$/ --feature-gates="Accelerators=true"/' ${FILE_NAME}
sudo systemctl daemon-reload
sudo systemctl restart kubelet
sudo kubeadm init --apiserver-advertise-address=$1
sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf
kubectl apply -f https://git.io/weave-kube-1.6
kubectl create -f https://git.io/kube-dashboard