-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.sh
61 lines (50 loc) · 2.09 KB
/
utils.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
#!/bin/bash
set -e
function up-pods() {
CONFIG_PATH=$(cd `dirname ${BASH_SOURCE}`; pwd)/config/
kubectl create -f ${CONFIG_PATH}flannel-rbac.yaml --namespace=kube-system
kubectl create -f ${CONFIG_PATH}flannel.yaml
kubectl create -f ${CONFIG_PATH}heapster-standalone.yaml
kubectl create -f ${CONFIG_PATH}dashboard.yaml
}
function provision-master() {
ssh -t $1 "echo ${SUDO_PASSWD} | sudo -S -- /bin/bash -i -ce '
set -e
sudo kubeadm init --kubernetes-version ${KUBERNETES_VERSION} --pod-network-cidr=10.244.0.0/16 --token ${token} --token-ttl ${token_ttl}
mkdir -p \$HOME/.kube
sudo cp -f /etc/kubernetes/admin.conf \$HOME/.kube/config
sudo chown $(id -u):$(id -g) \$HOME/.kube/config
source \$HOME/kubernetes/utils.sh
up-pods
'"
}
function provision-masterandworker() {
ssh -t $1 "echo ${SUDO_PASSWD} | sudo -S -- /bin/bash -i -ce '
set -e
sudo kubeadm init --kubernetes-version ${KUBERNETES_VERSION} --pod-network-cidr=10.244.0.0/16 --token ${token} --token-ttl ${token_ttl}
mkdir -p \$HOME/.kube
sudo cp -f /etc/kubernetes/admin.conf \$HOME/.kube/config
sudo chown $(id -u):$(id -g) \$HOME/.kube/config
kubectl taint nodes --all node-role.kubernetes.io/master-
echo -e "[Service]\\\\nEnvironment=KUBELET_EXTRA_ARGS=--feature-gates=Accelerators=true" > my_kubelet.conf
sudo chmod 640 my_kubelet.conf
sudo chown root:root my_kubelet.conf
sudo mv my_kubelet.conf /etc/systemd/system/kubelet.service.d/
sudo systemctl daemon-reload
sudo systemctl restart kubelet.service
source \$HOME/kubernetes/utils.sh
up-pods
'"
}
function provision-worker() {
ssh -t $1 "echo ${SUDO_PASSWD} | sudo -S -- /bin/bash -i -ce '
set -e
sudo kubeadm join --token ${token} --skip-preflight-checks $2:6443
echo -e "[Service]\\\\nEnvironment=KUBELET_EXTRA_ARGS=--feature-gates=Accelerators=true" > my_kubelet.conf
sudo chmod 640 my_kubelet.conf
sudo chown root:root my_kubelet.conf
sudo mv my_kubelet.conf /etc/systemd/system/kubelet.service.d/
sudo systemctl daemon-reload
sudo systemctl restart kubelet.service
'"
}