-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·48 lines (35 loc) · 1.77 KB
/
setup.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
#!/bin/bash
source config.env
# TODO: assert that the config values are set
function fill_template() {
envsubst < $1 | sudo tee $2 > /dev/null
}
# TODO: add SSL creation part....
# SSL security
sudo mkdir -p /etc/kubernetes/ssl
sudo chmod 600 /etc/kubernetes/ssl/*-key.pem
sudo chown root:root /etc/kubernetes/ssl/*-key.pem
# flannel
fill_template ./configs/flannel_options.env /etc/flannel/options.env
sudo cp ./configs/40-ExecStartPre-symlink.conf /etc/systemd/system/flanneld.service.d/40-ExecStartPre-symlink.conf
# docker
sudo cp ./configs/40-flannel.conf /etc/systemd/system/docker.service.d/40-flannel.conf
sudo cp ./configs/docker_opts_cni.env /etc/kubernetes/cni/docker_opts_cni.env
sudo cp ./configs/10-flannel.conf /etc/kubernetes/cni/net.d/10-flannel.conf
# kubelet.service
fill_template ./configs/kubelet.service.in /etc/systemd/system/kubelet.service
fill_template ./configs/kubelet.service.in /etc/systemd/system/kubelet.service
fill_template ./configs/kube-apiserver.yaml.in /etc/kubernetes/manifests/kube-apiserver.yaml
fill_template ./configs/kube-proxy.yaml.in /etc/kubernetes/manifests/kube-proxy.yaml
fill_template ./configs/kube-controller-manager.yaml.in /etc/kubernetes/manifests/kube-controller-manager.yaml
fill_template ./configs/kube-scheduler.yaml.in /etc/kubernetes/manifests/kube-scheduler.yaml
sudo systemctl daemon-reload
etcdctl set /coreos.com/network/config '{ "Network": "${SERVICE_IP_RANGE}" }'
sudo systemctl start flanneld
sudo systemctl start kubelet
curl http://127.0.0.1:8080/version
sudo systemctl enable flanneld
sudo systemctl enable kubelet
# get kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
sudo mv kubectl /opt/bin