-
Notifications
You must be signed in to change notification settings - Fork 6
/
run
executable file
·70 lines (64 loc) · 2.29 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
#!/bin/bash
KUBERNETES_MASTER="${KUBERNETES_MASTER:-$(hostname -s)}"
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}}')
LABELS="$LABELS,role=master,node.kubernetes.io/master=true"
TAINTS="node.kubernetes.io/master=:NoSchedule,CriticalAddonsOnly=:NoSchedule"
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 kmaster
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 kmaster \
-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 CGROUP_DRIVER="$CGROUP_DRIVER" \
-e KUBECONFIG="/var/lib/vault-data/cluster-admin-kubeconfig.yml" \
--net=host \
--pid=host \
--privileged=true \
-p 10250:10250 \
-p 8200:8200 \
-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`/etcd-data:/var/lib/etcd-data \
-v `pwd`/vault-data:/var/lib/vault-data \
-v /var/log:/var/log \
-v /local-data/:/local-data:rw,shared \
-d kubernetes-master