-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun
executable file
·72 lines (66 loc) · 2.19 KB
/
run
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
#!/bin/bash
KUBERNETES_MASTER=$1
NODE_NAME="${NODE_NAME:-$(hostname -s)}"
CLUSTER_CIDR="${CLUSTER_CIDR:-10.0.0.0/16}"
FEATURE_GATES="${FEATURE_GATES:-}"
# use same cgroup as Docker
CGROUP_DRIVER=$(docker info --format '{{print .CgroupDriver}}')
if [ -z "$KUBERNETES_MASTER" ]; then
echo "KUBERNETES_MASTER not set"
exit 1
fi
echo "PROVIDERID=$PROVIDERID"
echo "KUBERNETES_MASTER=$KUBERNETES_MASTER"
echo "LABELS=$LABELS"
echo "TAINTS=$TAINTS"
if ! grep "/var/lib/kubelet " /proc/self/mountinfo | grep shared; then
echo "Making /var/lib/kubelet shared."
mkdir -p /var/lib/kubelet
mount --bind /var/lib/kubelet /var/lib/kubelet
mount --make-shared /var/lib/kubelet
fi
rpc.statd
swapoff -a
mkdir -p /local-data
# reset
docker rm -f knode
umount /var/lib/kubelet/volumeplugins
# Critical OS Settings
sysctl -w net.ipv4.ip_forward=1
modprobe br_netfilter
sysctl -w net.bridge.bridge-nf-call-iptables=1
sysctl fs.inotify.max_user_watches=524288
docker run \
--name knode \
-e PROVIDERID="$PROVIDERID" \
-e LABELS="$LABELS" \
-e TAINTS="$TAINTS" \
-e KUBERNETES_MASTER="https://$KUBERNETES_MASTER:6443" \
-e NODE_NAME="$NODE_NAME" \
-e REGION="$REGION" \
-e VPC_ID="$VPC_ID" \
-e FEATURE_GATES="$FEATURE_GATES" \
-e CLUSTER_CIDR="$CLUSTER_CIDR" \
-e ALT_NAMES="$(hostname),$(hostname -I|tr ' ' ','),$ALT_NAMES" \
-e VAULT_ADDR="http://$KUBERNETES_MASTER:8200" \
-e KUBELET_TOKEN="$KUBELET_TOKEN" \
-e PROXY_TOKEN="$PROXY_TOKEN" \
-e CGROUP_DRIVER="$CGROUP_DRIVER" \
--net=host \
--pid=host \
--privileged=true \
-p 10250:10250 \
-v /sys:/sys:rw \
-v /:/rootfs:ro \
-v /dev:/dev:rw \
-v /lib/modules:/lib/modules:ro \
-v /var/run:/var/run:rw \
-v /var/lib/docker/:/var/lib/docker:rw \
-v /var/lib/kubelet/:/var/lib/kubelet:rw,shared \
-v /var/lib/kubelet/volumeplugins:/var/lib/kubelet/volumeplugins:rw \
-v /var/lib/calico/:/var/lib/calico:ro \
-v /etc/cni/net.d:/etc/cni/net.d:ro \
-v `pwd`/pki-data:/srv/kubernetes \
-v /var/log:/var/log \
-v /local-data/:/local-data:rw,shared \
-d kubernetes-node