-
Notifications
You must be signed in to change notification settings - Fork 2
/
kubeadm_deploy_step5.sh.backup
118 lines (90 loc) · 4.89 KB
/
kubeadm_deploy_step5.sh.backup
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
vi /etc/selinux/config
SELINUX=disabled
reboot
Disable
sudo swapoff -a
Enabled
sudo swapon -a
cat << EOF > /etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf
[Service]
ExecStart=
ExecStart=/usr/bin/kubelet --pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --cgroup-driver=systemd --runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice
Restart=always
EOF
vi /etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf
--runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice
journalctl -f
rm -rf /var/lib/etcd/*
systemctl daemon-reload
systemctl restart kubelet
kubectl config view
kubectl config set-cluster CLUSTER_NAME_FROM_CREDENTIALS
kubectl config set-context CONTEXT_NAME_FROM_CREDENTIALS
kubeadm init --kubernetes-version stable
kubeadm init --kubernetes-version=stable
kubeadm alpha phase certs etcd-server --config=/tmp/192.168.1.9/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-peer --config=/tmp/192.168.1.9/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-healthcheck-client --config=/tmp/192.168.1.9/kubeadmcfg.yaml
kubeadm alpha phase certs apiserver-etcd-client --config=/tmp/192.168.1.9/kubeadmcfg.yaml
cp -R /etc/kubernetes/pki /tmp/192.168.1.9/
# cleanup non-reusable certificates
find /etc/kubernetes/pki -not -name ca.crt -not -name ca.key -type f -delete
kubeadm alpha phase certs etcd-server --config=/tmp/192.168.1.8/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-peer --config=/tmp/192.168.1.8/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-healthcheck-client --config=/tmp/192.168.1.8/kubeadmcfg.yaml
kubeadm alpha phase certs apiserver-etcd-client --config=/tmp/192.168.1.8/kubeadmcfg.yaml
cp -R /etc/kubernetes/pki /tmp/192.168.1.8/
# cleanup non-reusable certificates
find /etc/kubernetes/pki -not -name ca.crt -not -name ca.key -type f -delete
kubeadm alpha phase certs etcd-server --config=/tmp/192.168.1.7/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-peer --config=/tmp/192.168.1.7/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-healthcheck-client --config=/tmp/192.168.1.7/kubeadmcfg.yaml
kubeadm alpha phase certs apiserver-etcd-client --config=/tmp/192.168.1.7/kubeadmcfg.yaml
cp -R /etc/kubernetes/pki /tmp/192.168.1.7/
# cleanup non-reusable certificates
find /etc/kubernetes/pki -not -name ca.crt -not -name ca.key -type f -delete
kubeadm alpha phase certs etcd-server --config=/tmp/192.168.1.6/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-peer --config=/tmp/192.168.1.6/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-healthcheck-client --config=/tmp/192.168.1.6/kubeadmcfg.yaml
kubeadm alpha phase certs apiserver-etcd-client --config=/tmp/192.168.1.6/kubeadmcfg.yaml
cp -R /etc/kubernetes/pki /tmp/192.168.1.6/
find /etc/kubernetes/pki -not -name ca.crt -not -name ca.key -type f -delete
kubeadm alpha phase certs etcd-server --config=/tmp/192.168.1.5/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-peer --config=/tmp/192.168.1.5/kubeadmcfg.yaml
kubeadm alpha phase certs etcd-healthcheck-client --config=/tmp/192.168.1.5/kubeadmcfg.yaml
kubeadm alpha phase certs apiserver-etcd-client --config=/tmp/192.168.1.5/kubeadmcfg.yaml
# No need to move the certs because they are for zoo1
# clean up certs that should not be copied off this host
find /tmp/192.168.1.9 -name ca.key -type f -delete
find /tmp/192.168.1.8 -name ca.key -type f -delete
find /tmp/192.168.1.7 -name ca.key -type f -delete
find /tmp/192.168.1.6 -name ca.key -type f -delete
mkdir /home/root
cp -r /tmp/192.168.1.6/* /home/root
cp -r /tmp/192.168.1.7/* /home/root
cp -r /tmp/192.168.1.8/* /home/root
cp -r /tmp/192.168.1.9/* /home/root
root@zoo1 $ kubeadm alpha phase etcd local --config=/tmp/192.168.1.5/kubeadmcfg.yaml
root@zoo2 $ kubeadm alpha phase etcd local --config=/home/root/kubeadmcfg.yaml
root@zoo3 $ kubeadm alpha phase etcd local --config=/home/root/kubeadmcfg.yaml
root@zoo4 $ kubeadm alpha phase etcd local --config=/home/root/kubeadmcfg.yaml
root@zoo5 $ kubeadm alpha phase etcd local --config=/home/root/kubeadmcfg.yaml
chown -R root:root /etc/kubernetes/pki
docker run --rm -it \
--net host \
-v /etc/kubernetes:/etc/kubernetes quay.io/coreos/etcd:v3.2.18 etcdctl \
--cert-file /etc/kubernetes/pki/etcd/peer.crt \
--key-file /etc/kubernetes/pki/etcd/peer.key \
--ca-file /etc/kubernetes/pki/etcd/ca.crt \
--endpoints https://192.168.1.5:2379 cluster-health
vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
--pod-infra-container-image=registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64:3.1
systemctl enable kubelet && systemctl start kubelet
sysctl net.bridge.bridge-nf-call-iptables=1
systemctl status kubelet
docker pull kubernetes/pause
docker images | grep pause
docker tag f9d5de079539 k8s.gcr.io/pause:3.1
docker pull outrider/etcd-amd64
docker images | grep etcd-amd
docker tag a9308c067589 k8s.gcr.io/etcd-amd64:3.2.18