Skip to content

Commit 5ffb78e

Browse files
committed
2019-02-10 完善 K8S
1 parent ea85f55 commit 5ffb78e

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

markdown-file/K8S-Install-And-Usage.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
- <https://github.com/kubernetes-incubator/kubespray>
4949
- <https://github.com/apprenda/kismatic>
5050

51-
#### 开始安装 - Kubernetes 1.13.3 版本
51+
#### 开始安装 - Kubernetes 1.13.2 版本
5252

5353
- 三台机子:
5454
- master-1:`192.168.0.127`
@@ -74,8 +74,8 @@ systemctl disable iptables.service
7474
7575
setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
7676
77-
swapoff -a && sysctl -w vm.swappiness=0
7877
echo "vm.swappiness = 0" >> /etc/sysctl.conf
78+
swapoff -a && sysctl -w vm.swappiness=0
7979
8080
8181
@@ -133,7 +133,7 @@ scp -r /etc/yum.repos.d/kubernetes.repo root@k8s-node-2:/etc/yum.repos.d/
133133
iptables -P FORWARD ACCEPT
134134
135135
所有机子
136-
yum install -y kubelet-1.13.3 kubeadm-1.13.3 kubectl-1.13.3 --disableexcludes=kubernetes
136+
yum install -y kubelet-1.13.2 kubeadm-1.13.2 kubectl-1.13.2 --disableexcludes=kubernetes
137137
138138
139139
所有机子
@@ -198,7 +198,7 @@ echo 1 > /proc/sys/net/ipv4/ip_forward
198198
kubeadm init \
199199
--image-repository registry.cn-hangzhou.aliyuncs.com/google_containers \
200200
--pod-network-cidr 10.244.0.0/16 \
201-
--kubernetes-version 1.13.3 \
201+
--kubernetes-version 1.13.2 \
202202
--service-cidr 10.96.0.0/12 \
203203
--apiserver-advertise-address=0.0.0.0 \
204204
--ignore-preflight-errors=Swap
@@ -207,7 +207,7 @@ kubeadm init \
207207
208208
这个过程会下载一些 docker 镜像,时间可能会比较久,看你网络情况。
209209
终端会输出核心内容:
210-
[init] Using Kubernetes version: v1.13.3
210+
[init] Using Kubernetes version: v1.13.2
211211
[preflight] Running pre-flight checks
212212
[preflight] Pulling images required for setting up a Kubernetes cluster
213213
[preflight] This might take a minute or two, depending on the speed of your internet connection
@@ -223,12 +223,12 @@ kubeadm init \
223223
[certs] Generating "front-proxy-ca" certificate and key
224224
[certs] Generating "front-proxy-client" certificate and key
225225
[certs] Generating "etcd/ca" certificate and key
226-
[certs] Generating "etcd/healthcheck-client" certificate and key
227-
[certs] Generating "apiserver-etcd-client" certificate and key
228226
[certs] Generating "etcd/server" certificate and key
229227
[certs] etcd/server serving cert is signed for DNS names [k8s-master-1 localhost] and IPs [192.168.0.127 127.0.0.1 ::1]
228+
[certs] Generating "apiserver-etcd-client" certificate and key
230229
[certs] Generating "etcd/peer" certificate and key
231230
[certs] etcd/peer serving cert is signed for DNS names [k8s-master-1 localhost] and IPs [192.168.0.127 127.0.0.1 ::1]
231+
[certs] Generating "etcd/healthcheck-client" certificate and key
232232
[certs] Generating "sa" key and public key
233233
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
234234
[kubeconfig] Writing "admin.conf" kubeconfig file
@@ -241,14 +241,13 @@ kubeadm init \
241241
[control-plane] Creating static Pod manifest for "kube-scheduler"
242242
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
243243
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
244-
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
245-
[apiclient] All control plane components are healthy after 32.002189 seconds
244+
[apiclient] All control plane components are healthy after 18.002437 seconds
246245
[uploadconfig] storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
247246
[kubelet] Creating a ConfigMap "kubelet-config-1.13" in namespace kube-system with the configuration for the kubelets in the cluster
248247
[patchnode] Uploading the CRI Socket information "/var/run/dockershim.sock" to the Node API object "k8s-master-1" as an annotation
249248
[mark-control-plane] Marking the node k8s-master-1 as control-plane by adding the label "node-role.kubernetes.io/master=''"
250249
[mark-control-plane] Marking the node k8s-master-1 as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]
251-
[bootstrap-token] Using token: 3ag6sz.y8rmcz5xec50xkz1
250+
[bootstrap-token] Using token: yes6xf.5huewerdtfxafde5
252251
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
253252
[bootstraptoken] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
254253
[bootstraptoken] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
@@ -272,8 +271,7 @@ Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
272271
You can now join any number of machines by running the following on each node
273272
as root:
274273
275-
kubeadm join 192.168.0.127:6443 --token cdo0z3.msyp89yp8zk6lhmf --discovery-token-ca-cert-hash sha256:c0d8942e801962232f0e02b757d13ed0034fa07ab3953764e6a6c67b6688963c
276-
274+
kubeadm join 192.168.0.127:6443 --token yes6xf.5huewerdtfxafde5 --discovery-token-ca-cert-hash sha256:98dd48ac4298e23f9c275309bfd8b69c5b3166752ccf7a36c2affcb7c1988781
277275
278276
279277
@@ -284,7 +282,7 @@ sudo chown $(id -u):$(id -g) $HOME/.kube/config
284282
export KUBECONFIG=$HOME/.kube/config
285283
286284
查询我们的 token
287-
kubectl cluster-info
285+
kubeadm token list
288286
289287
kubectl cluster-info
290288
@@ -301,7 +299,7 @@ kubectl apply -f /opt/kube-flannel.yml
301299
```
302300
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
303301
304-
kubeadm join 192.168.0.127:6443 --token cdo0z3.msyp89yp8zk6lhmf --discovery-token-ca-cert-hash sha256:c0d8942e801962232f0e02b757d13ed0034fa07ab3953764e6a6c67b6688963c
302+
kubeadm join 192.168.0.127:6443 --token yes6xf.5huewerdtfxafde5 --discovery-token-ca-cert-hash sha256:98dd48ac4298e23f9c275309bfd8b69c5b3166752ccf7a36c2affcb7c1988781
305303
306304
这时候终端会输出:
307305

0 commit comments

Comments
 (0)