Linux服务器部署K8S程序集群的操作历史记录
前端时间在做一个服务器的备份,这个服务器使用的部署方式是K8S,当初为了解决K8S的问题,也是花了一个多月,才算是入门了K8S,对于初学者来说,确实比较复杂。
本文纯粹为了记录历史命令记录,简单的、复杂的都有,不做任何技术分析。也便于今后的K8S部署做参考,等将来有时间了,再把K8S的技术知识重温一下,整理成合集进行发布
历史记录
[root@master1 ~]# history
1 vi nginx.conf
2 cd conf.d/
3 ls
4 vi nyfwypt.conf
5 ls
6 cd ..
7 ls
8 vi docker-compose.yml
9 cd /green/
10 ls
11 cd docker-master/
12 ls
13 cd ..
14 ls
15 cd dockerdata/
16 ls
17 cd ..
18 ls
19 cd db/
20 ls
21 cd ..
22 kubectl get pods -n default
23 kubectl logs svc-config-69bcbf9b5-m4chp -n default
24 kubectl get pods -n default
25 kubectl logs redis-7c67cc97bb-cjrrx -n default
26 kubectl logs nginx-668f7669c7-jthd2 -n default
27 kubectl logs green-59b9cc5d46-pfl5b -n default
28 kubectl delete pod green-59b9cc5d46-pfl5b -n default
29 kubectl get pods -n default
30 kubectl logs gateway2-58f49587f6-z9kvr -n default
31 kubectl delete pod gateway2-58f49587f6-z9kvr -n default
32 kubectl get pods -n default
33 kubectl logs gateway2-58f49587f6-kzph4 -n default
34 kubectl get pods -n default
35 kubectl logs gateway2-58f49587f6-kzph4 -n default
36 kubectl get pods -n default
37 kubectl delete pod gateway2-58f49587f6-kzph4 -n default
38 kubectl get pods -n default
39 kubectl logs gateway2-7895fbbf74-krpnd -n default
40 kubectl get pods -n default
41 ls
42 cd ..
43 ls
44 cd /green/project/
45 ls
46 cd nginx/
47 ls
48 vi conf.d/nyfwypt.conf
49 cd ..
50 ls
51 cd html/
52 ls
53 cd front/
54 ls
55 ll- a
56 ll -a
57 cd ..
58 ls
59 cd web/
60 ls
61 vi index.html
62 cd ..
63 ls
64 cd
65 cd /green/
66 ls
67 cd project/
68 ls
69 cd nginx/
70 ls
71 vi conf.d/nyfwypt.conf
72 cd /green/project/
73 ls
74 config-service/
75 ls
76 cd config-service/
77 ls
78 cd ..
79 ls
80 find / -name "*.html"
81 find / -name "*/green/*.html"
82 cd /usr/local/
83 ls
84 cd sbin/
85 ls
86 cd ..
87 ls
88 cd ..
89 ls
90 cd /
91 ls
92 cd green/
93 ls
94 systemctl restart docker
95 kubectl get pods -n default
96 kubectl get svc -n default
97 kubectl logs green-59b9cc5d46-4xkcc -n default
98 kubectl get pods -n default
99 kubectl logs base-service-67b4f6698b-4twnc -n default
100 kubectl get pods -n default
101 kubectl logs auth-service-6954dd8558-t6jdl -n default
102 kubectl get pods -n default
103 kubectl delete pod auth-service-6954dd8558-t6jdl -n default
104 kubectl get pods -n default
105 kubectl logs auth-service-6954dd8558-dlpcb -n default
106 kubectl get pods -n default
107 kubectl delete pod auth-service-6954dd8558-dlpcb -n default
108 kubectl get pods -n default
109 kubectl logs auth-service-6954dd8558-7vzr9 -n default
110 kubectl describe pod auth-service-6954dd8558-7vzr9 -n default
111 kubectl get pods -n default
112 kubectl describe pod auth-service-6954dd8558-7vzr9 -n default
113 kubectl get pods -n default
114 kubectl logs auth-service-6c49b8c6fc-f42rk -n default
115 kubectl get pods -n default
116 kubectl logs auth-service-6c49b8c6fc-f42rk -n default
117 kubectl get pods -n default
118 kubectl logs base-service-67b4f6698b-4twnc -n default
119 kubectl get pods -n default
120 kubectl logs db-mysql-796d866db5-hgv4t -n default
121 kubectl get pods -n default
122 kubectl logs eureka-76789c645-jktl2 -n default
123 kubectl get pods -n default
124 kubectl logs green-59b9cc5d46-4xkcc -n default
125 kubectl get pods -n default
126 kubectl logs nginx-668f7669c7-jthd2 -n default
127 kubectl logs redis-7c67cc97bb-cjrrx -n default
128 kubectl logs svc-config-6996c596c7-57f9v -n default
129 cd /green/project/
130 ls
131 kubectl get pods -n default
132 kubectl logs base-service-8b8ff67f9-xqtzd -n default
133 kubectl get pods -n default
134 kubectl delete pod base-service-8b8ff67f9-xqtzd -n default
135 kubectl get pods -n default
136 kubectl delete pod eureka-78587576ff-z8cvm -n default
137 kubectl get pods -n default
138 kubectl delete pod base-service-8b8ff67f9-q6k74 -n default
139 kubectl get pods -n default
140 kubectl logs eureka-78587576ff-j6t46 -n default
141 history|grep echo
142 echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-user | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
143 kubectl get pods
144 kubectl logs eureka-5d697c6c4c-8vv9w
145 kubectl get pods
146 kubectl logs eureka-78587576ff-w4z9d
147 kubectl get pods
148 kubectl logs eureka-78587576ff-w4z9d
149 kubectl get pods
150 kubectl logs svc-config-6996c596c7-57f9v
151 kubectl get pods
152 kubectl delete pod svc-config-6996c596c7-57f9v -n default
153 kubectl get pods
154 kubectl logs svc-config-6996c596c7-6vgkd
155 kubectl get pods
156 kubectl delete pod gateway2-7895fbbf74-krpnd -n default
157 kubectl delete pod auth-service-6c49b8c6fc-f42rk -n default
158 kubectl delete pod green-59b9cc5d46-4xkcc -n default
159 kubectl delete pod base-service-9f897f7d-rzblg -n default
160 kubectl get pods -n default
161 kubectl logs base-service-9f897f7d-b4hxp
162 ls
163 cd /
164 ls
165 cd /green/
166 ls
167 cd project/
168 ls
169 cd gateway/
170 ls
171 vi Dockerfile
172 free -h
173 kubectl get pods -n default
174 kubectl logs green-59b9cc5d46-nf5hf
175 kubectl get pods -n default
176 docker ps -a |grep green
177 docker ps -a
178 kubectl get pods -n kube-system
179 docker ps -a
180 kubectl get pods -n default
181 docker describe pod green-59b9cc5d46-nf5hf
182 docker describe pod green-59b9cc5d46-nf5hf -n default
183 kubectl describe pod green-59b9cc5d46-nf5hf -n default
184 systemctl status kubelet
185 ls
186 cd ..
187 ls
188 cd config
189 ls
190 vi gateway-prod.yaml
191 kubectl get pods -n default
192 kubectl delete pod gateway2-7895fbbf74-lvxj2 -n default
193 kubectl delete pod green-59b9cc5d46-nf5hf -n default
194 kubectl get pods -n default
195 kubectl logs auth-service-6c49b8c6fc-mxct4
196 kubectl get pods -n default
197 kubectl logs base-service-9f897f7d-b4hxp
198 kubectl get pods -n default
199 kubectl logs green-59b9cc5d46-pvsj9
200 ls
201 history |grep echo
202 echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-user | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
203 ls
204 cd /green/
205 ls
206 cd ..
207 ls
208 cd /mnt/
209 ls
210 cd ..
211 ls
212 cd home/
213 ls
214 cd user/
215 ls
216 cd ..
217 ls
218 cd ..
219 ls
220 cd data1/
221 ls
222 cd ..
223 ls
224 cd /green/
225 cd db/
226 ls
227 cd mysqldata/
228 telnet localhost 3306
229 history |grep echo
230 kubectl get pods -n defaul
231 kubectl get pods -n default
232 kubectl logs green-59b9cc5d46-pvsj9
233 kubectl get pods -n default
234 kubectl logs db-mysql-796d866db5-hgv4t
235 cd ..
236 ls
237 cd /green/
238 ls
239 cd project/
240 ls
241 cd gateway/
242 ls
243 cd ..
244 ls
245 kubectl get pods -n default
246 kubectl delete pod gateway2-689446c4-p5khq -n default
247 kubectl get pods -n default
248 kubectl logs gateway2-689446c4-v8sz4
249 curl -k http://10.21.232.4:8080
250 kubectl get pods -n default
251 kubectl logs gateway2-86b5b5d8df-4xsgr
252 curl -k http://10.21.232.4:9000
253 curl -k http://10.21.232.4:9001
254 curl -k http://10.21.232.4:80
255 curl -k http://10.21.232.4:30081
256 curl -k http://10.21.232.5:9001
257 curl -k http://10.21.232.5:9000
258 ls
259 vi config
260 cd config
261 ls
262 vi application-prod.yaml
263 vi gateway-prod.yaml
264 curl -k http://10.21.232.5:443
265 kubectl logs green-5c8679ddd5-fcr8x
266 kubectl get pods -n default
267 kubectl logs gateway2-7895fbbf74-qv7z9
268 cd /green/
269 ls
270 cd project/
271 ls
272 curl -k http:127.0.0.1:8080/g/v1/greenProduct/quantityStatistics
273 curl -k http://127.0.0.1:8080/g/v1/greenProduct/quantityStatistics
274 history
275 history|grep jour
276 journalctl -xeu kubelet
277 journalctl -xfeu kubelet
278 kubectl logs gateway2-7895fbbf74-qv7z9
279 kubectl
280 kubectl get pods -n default
281 kubectl logs eureka-78587576ff-rfx5t
282 kubectl get pods -n default
283 kubectl delete pod eureka-78587576ff-rfx5t -n default
284 kubectl ge
285 kubectl logs eureka-78587576ff-66fwz
286 kubectl get pods -n default
287 kubectl logs eureka-78587576ff-66fwz
288 kubectl get pods -n default
289 kubectl logs svc-config-6685bb8f99-gswsv
290 kubectl get pods -n default
291 kubectl delete pod svc-config-6685bb8f99-gswsv
292 kubectl get pods -n default
293 kubectl logs svc-config-6685bb8f99-bvt2f
294 kubectl get pods -n default
295 kubectl logs eureka-78587576ff-jv8m8
296 kubectl get pods -n default
297 kubectl delete pod eureka-78587576ff-jv8m8
298 kubectl get pods -n default
299 kubectl logs eureka-78587576ff-544g7
300 kubectl get pods -n default
301 kubectl delete pod svc-config-6685bb8f99-bvt2f
302 kubectl get pods -n default
303 kubectl logs svc-config-6685bb8f99-mp6vq
304 kubectl get pods -n default
305 kubectl logs eureka-78587576ff-544g7
306 kubectl get pods -n default
307 kubectl delete pod eureka-78587576ff-544g7
308 kubectl get pods -n default
309 kubectl delete pod eureka-78587576ff-4ng7p
310 kubectl get pods -n default
311 kubectl logs eureka-78587576ff-xfqs7
312 kubectl get pods -n default
313 kubectl logs eureka-78587576ff-xfqs7
314 kubectl get pods -n default
315 kubectl delete pod eureka-94f546f7b-g2jrz
316 kubectl get pods -n default
317 kubectl delete pod eureka-94f546f7b-r9zrl
318 kubectl get pods -n default
319 kubectl delete pod eureka-94f546f7b-7m76f
320 kubectl get pods -n default
321 kubectl describe pod eureka-94f546f7b-7m76f
322 kubectl describe pod eureka-94f546f7b-7m76f -n default
323 kubectl describe pod eureka-94f546f7b-dnhpg -n default
324 kubectl get pods -n default
325 kubectl logs eureka-78587576ff-xfmqj
326 kubectl get pods -n default
327 kubectl logs svc-config-6685bb8f99-mp6vq
328 kubectl get pods -n default
329 kubectl delete pod svc-config-6685bb8f99-mp6vq
330 kubectl get pods -n default
331 kubectl logs svc-config-6685bb8f99-nr87r
332 kubectl get pods -n default
333 kubectl delete pod auth-service-7c5b4f65b6-9wcb8
334 kubectl delete pod base-service-98c64dc7b-fj995
335 kubectl delete pod green-74468b9974-sp6zd
336 kubectl get pods -n default
337 kubectl delete pod gateway2-5b9f5bdd8b-mqkcj
338 kubectl delete pod nginx-6499fb78d5-c5l2n
339 kubectl get pods -n default
340 kubectl logs auth-service-7c5b4f65b6-nclfx
341 kubectl get pods -n default
342 kubectl logs gateway2-5b9f5bdd8b-nlk8v
343 kubectl get pods -n default
344 kubectl logs green-74468b9974-9stvn
345 kubectl get ep
346 kubectl delete ep kubernetes
347 kubectl get ep
348 kubectl get svc -n default
349 kubectl get svc -n kube-system
350 ls
351 cd ..
352 ls
353 kubectl get pods -n kube-system
354 kubectl delete pod etcd-master1
355 kubectl delete pod etcd-master1 -n kube-system
356 kubectl delete pod kube-proxy-9ghwl -n kube-system
357 kubectl delete pod kube-proxy-ck2z9 -n kube-system
358 kubectl delete pod kube-proxy-csqnc -n kube-system
359 kubectl delete pod kube-proxy-vvn2w -n kube-system
360 kubectl delete pod kube-scheduler-m -n kube-system
361 kubectl get pods -n kube-system
362 kubectl delete pod kube-proxy-d58dn -n kube-system
363 kubectl delete pod kube-proxy-zhgvj -n kube-system
364 kubectl get pods -n kube-system
365 kubectl get pods -n defaut
366 kubectl get pods -n default
367 cd /mnt/
368 cd /green/
369 ls
370 cd project/
371 ls
372 kubectl get pods -n kube-system
373 history|grep kebelctl
374 history|grep kubelctl
375 history|grep kubectl
376 kubectl get pods -n kube-system
377 kubectl get pod -n kube-system |grep calico-node |awk '{print:$1}' |xargs kubectl delete pod -n kube-system
378 kubectl get pod -n kube-system |grep calico-node |awk '{print $1}' |xargs kubectl delete pod -n kube-system
379 kubectl get pods -n kube-system
380 kubectl get pod -n kube-system |grep calico-kube |awk '{print $1}' |xargs kubectl delete pod -n kube-system
381 kubectl get pod -n kube-system |grep coredns |awk '{print $1}' |xargs kubectl delete pod -n kube-system
382 ls
383 cd config-service/
384 ls
385 kubectl get pods -n default
386 kubectl logs svc-config-5d58f7c9fc-56pcm
387 kubectl get pods -n default
388 kubectl logs green-74468b9974-9stvn
389 kubectl get pods -n default
390 kubectl delete pod green-74468b9974-9stvn
391 kubectl get pods -n default
392 kubectl logs green-6f46c5f65c-7ndr9
393 ls
394 cd ..
395 ls
396 history
397 history|grep echo
398 echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-user | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
399 kubectl get pods -n default
400 docker logs auth-service-7c5b4f65b6-nclfx
401 kubectl logs auth-service-7c5b4f65b6-nclfx
402 kubectl get pods -n default
403 kubectl logs base-service-98c64dc7b-nzs4z
404 kubectl get pods -n default
405 kubectl logs gateway2-5b9f5bdd8b-nlk8v
406 kubectl get pods -n default
407 kubectl logs gateway2-c547b8c68-x
408 kubectl get pods -n kube-system
409 kubectl delete pod coredns-67c766df46-5th64 -n kube-system
410 kubectl get pods -n kube-system
411 history|grep echo
412 echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-user | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
413 ls
414 java -version
415 free -h
416 kubectl get pods -n default
417 kubectl get pods -n kube-system
418 ls
419 vi calico-3.9.2.yaml
420 ifconfig
421 kubectl get pods -n kube-system
422 kubectl delete pod coredns-79d5c79bb8-djss5 -n kube-system
423 kubectl get pods -n kube-system
424 kubectl delete pod calico-kube-controllers-67656bbccc-cw2tl -n kube-system
425 kubectl get pods -n kube-system
426 kubectl logs calico-kube-controllers-67656bbccc-z6pbx
427 kubectl get pods -n kube-system
428 kubectl logs calico-kube-controllers-67656bbccc-z6pbx -n kube-system
429 docker images
430 kubectl logs calico-kube-controllers-67656bbccc-z6pbx -n kube-system
431 kubectl delete pod calico-kube-controllers-67656bbccc-z6pbx -n kube-system
432 kubectl logs calico-kube-controllers-67656bbccc-z6pbx -n kube-system
433 kubectl get pods -n kube-system
434 kubectl logs calico-kube-controllers-67656bbccc-8zgcv -n kube-system
435 kubectl get pods -n kube-system
436 kubectl describe pod calico-kube-controllers-67656bbccc-8zgcv -n kube-system
437 docker images
438 kubectl describe pod calico-kube-controllers-67656bbccc-8zgcv -n kube-system
439 docker images
440 kubectl get pods -n kube-system
441 kubectl delete pod calico-kube-controllers-67656bbccc-8zgcv -n kube-system
442 kubectl get pods -n kube-system
443 kubectl describe pod calico-kube-controllers-67656bbccc-whwds -n kube-system
444 kubectl get pods -n kube-system
445 ifconfig
446 ifconfig cali4897aa5e6e1 down
447 ifconfig cali94137116f6a down
448 ifconfig calie60b9d67bee down
449 ifconfig virbr0 down
450 ifconfig
451 ls
452 kubectl apply -f calico-3.9.2.yaml
453 ifconfig
454 ls
455 kubectl get pods -n kube-system
456 kubectl apply -f calico-3.9.2.yaml
457 kubectl get pods -n kube-system
458 ifconfig
459 docker images
460 docker save -o 7f7ed50db9fb > calico-kube-controllers.tar.gz
461 docker save 7f7ed50db9fb > calico-kube-controllers.tar.gz
462 ls
463 docker save -o calico-kube-controllers.tar.gz 7f7ed50db9fb
464 ls
465 scp ./calico-kube-controllers.tar.gz root@10.21.232.5:/root/
466 scp ./calico-kube-controllers.tar.gz root@10.21.232.6:/root/
467 docker images
468 scp ./calico-kube-controllers.tar.gz root@10.21.232.7:/root/
469 scp ./calico-kube-controllers.tar.gz root@10.21.232.8:/root/
470 scp ./calico-kube-controllers.tar.gz root@10.21.232.9:/root/
471 docker images
472 kubectl get pods -n kube-system
473 ifconfig
474 ls
475 kubectl get pods -n kube-system
476 kubectl delete pod calico-kube-controllers-dc6cb64cb-ffdq6 -n kube-system
477 kubectl get pods -n kube-system
478 ifconfig
479 kubectl get pods -n kube-system
480 kubectl delete pod etcd-master1 -n kube-system
481 kubectl delete pod kube-controller-manager-master1 -n kube-system
482 kubectl delete pod kube-proxy-47hbn -n kube-system
483 kubectl delete pod kube-proxy-8rjnf -n kube-system
484 kubectl delete pod kube-proxy-cgnxp -n kube-system
485 kubectl delete pod kube-proxy-gh2x9 -n kube-system
486 kubectl delete pod kube-proxy-mfpf9 -n kube-system
487 kubectl delete pod kube-proxy-pg2tb -n kube-system
488 kubectl delete pod kuboard-59bdf4d5fb-mb4qm -n kube-system
489 systemctl daemon-reload
490 systemctl restart docker
491 kubectl get pods -n kube-system
492 kubectl delete pod calico-node-qsg6t -n kube-system
493 kubectl get pods -n kube-system
494 kubectl delete pod kuboard-59bdf4d5fb-qrplt -n kube-system
495 kubectl get pods -n kube-system
496 ifconfig
497 kubectl get pods -n kube-system
498 kubectl describe pod kuboard-59bdf4d5fb-7kgwf -n kube-system
499 kubectl get pods -n kube-system
500 docker images
501 ls
502 kubectl get pods -n kube-system
503 docker images
504 kubectl describe pod kuboard-59bdf4d5fb-7kgwf -n kube-system
505 ls
506 docker images
507 kubectl describe pod kuboard-59bdf4d5fb-7kgwf -n kube-system
508 kubectl get pods -n kube-system
509 docker images
510 docker save -o kuboard.tar a1a5060fe43d
511 scp ./kuboard.tar root@10.21.232.5:/root/
512 scp ./kuboard.tar root@10.21.232.6:/root/
513 scp ./kuboard.tar root@10.21.232.7:/root/
514 scp ./kuboard.tar root@10.21.232.8:/root/
515 scp ./kuboard.tar root@10.21.232.9:/root/
516 kubectl get pods -n kube-system
517 kubectl delete pod kuboard-59bdf4d5fb-7kgwf -n kube-system
518 kubectl get pods -n kube-system
519 kubectl describe pod kuboard-59bdf4d5fb-m8brf -n kube-system
520 vi /etc/docker/daemon.json
521 kubectl describe pod kuboard-59bdf4d5fb-m8brf -n kube-system
522 kubectl get pods -n kube-system
523 ls
524 vi kuboard.yaml
525 ls
526 kubectl delete -f kuboard.yaml
527 kubectl apply -f kuboard.yaml
528 kubectl get pods -n kube-system
529 kubectl describe pod kuboard-77846fcc6-2dxxx -n kube-system
530 kubectl get pods -n kube-system
531 kubectl describe pod kuboard-77846fcc6-ldddb -n kube-system
532 kubectl get pods -n kube-system
533 kubectl delete -f kuboard.yaml
534 kubectl apply -f kuboard.yaml
535 kubectl get pods -n kube-system
536 kubectl describe pod kuboard-77846fcc6-c6h28 -n kube-system
537 kubectl get pods -n kube-system
538 kubectl logs kuboard-77846fcc6-92ssc
539 kubectl get pods -n kube-system
540 vi kuboard.
541 vi kuboard.yaml
542 kubectl delete -f kuboard.yaml
543 kubectl apply -f kuboard.yaml
544 kubectl get pods -n kube-system
545 system restart kubelet
546 systemctl restart kubelet
547 systemctl restart docker
548 curl -vvv http://localhost:32567
549 ping www.baidu.com
550 vi /etc/hosts
551 telnet kuboard.cn 80
552 curl -vvv http://localhost:32567
553 kubectl get svc
554 kubectl get svc -n kube-system
555 curl -vvv http://10.96.165.159:32567
556 rcnetwork restart
557 /etc/rc.d/network restart
558 service network restart
559 if config
560 ifconfig
561 ls
562 curl -vvv http://localhost:32567
563 curl -k http://localhost:32567
564 kubectl get pods -n kube-system
565 kubectl get svc -n kube-system
566 curl -k http://localhost:32567
567 curl -k http://localhost:88
568 curl -k http://localhost:3256
569 curl -k http://localhost:32567
570 kubectl logs kuboard-6948759c89-4krd8
571 kubectl get pods -n kube-system
572 kubectl logs kuboard-6948759c89-4krd8 -n kube-system
573 netstat -ntlp |grep 32567
574 kubectl get pods -n kube-system
575 history|grep kubectl
576 kubectl get pod -n kube-system |grep kube-proxy |awk '{print $1}' |xargs kubectl delete pod -n kube-system
577 kubectl get pods -n kube-system
578 kubectl delete pod etcd-master1 -n kube-system
579 kubectl logs kuboard-6948759c89-4krd8 -n kube-system
580 kubectl delete pod kuboard-6948759c89-4krd8 -n kube-system
581 kubectl get pods -n kube-system
582 curl -k http://localhost:32567
583 curl -vvv http://localhost:32567
584 kubectl logs kuboard-6948759c89-4krd8 -n kube-system
585 curl -vvv http://localhost:32567
586 systemctl daemon-reload
587 curl -vvv http://localhost:32567
588 curl -vvv https://localhost:32567
589 kubectl get pods -n kube-system
590 kubectl delete pod metrics-server-5bd664ff57-g7mjr -n kube-system
591 kubectl get pods -n kube-system
592 kubectl logs metrics-server-5bd664ff57-z6c8t
593 kubectl logs metrics-server-5bd664ff57-z6c8t -n kube-system
594 docker images
595 kubectl logs metrics-server-5bd664ff57-z6c8t -n kube-system
596 docker images
597 kubectl describe pod metrics-server-5bd664ff57-z6c8t -n kube-system
598 docker images
599 docker save -o metrics-server.tar 07c9e703ca2c
600 ls
601 scp ./metrics-server.tar root@10.21.232.5:/root/
602 scp ./metrics-server.tar root@10.21.232.6:/root/
603 scp ./metrics-server.tar root@10.21.232.7:/root/
604 scp ./metrics-server.tar root@10.21.232.8:/root/
605 scp ./metrics-server.tar root@10.21.232.9:/root/
606 docker images
607 kubectl get pods -n kube-system
608 kubectl delete pod metrics-server-5bd664ff57-z6c8t -n kube-system
609 kubectl get pods -n kube-system
610 docker images
611 kubectl get pods -n kube-system
612 cat /etc/resolv.conf
613 curl https://www.baidu.com
614 ip a |grep 10.21.
615 mkdir /opt/ah
616 cd /opt/ah/
617 wget http://59.231.11.178/download/linux/administrator/out/agent_setup.sh
618 chmod +x agent_setup.sh
619 sh agent_setup.sh
620 lsmod |grep edr
621 hisory
622 history
623 kubectl get pods -n kube-system
624 kubectl get pods -n default
625 history
626 kubectl delete pod metrics-server-5bd664ff57-z6c8t -n kube-system
627 kubectl delete pod gateway2-84977bfb96-dcdzp -n kube-system
628 kubectl delete pod gateway2-84977bfb96-dcdzp -n default
629 kubectl get svc -n default
630 kubectl get pods -n default
631 kubectl logs gateway2-84977bfb96-7m2gj
632 kubectl get pods -n default
633 kubectl logs green-6c6dcfb74f-cnd6c
634 kubectl get pods -n default
635 kubectl delete pod green-6c6dcfb74f-cnd6c -n default
636 kubectl get pods -n default
637 kubectl logs green-6c6dcfb74f-88ljc
638 kubectl get pods -n default
639 virsh net-list
640 find / -name default.xml
641 service libvirt-bin restart
642 systemctl restart libvirtd.service
643 ifconfig
644 systemctl status libvirtd.service
645 ifconfig
646 systemctl stop libvirtd.service
647 systemctl start libvirtd.service
648 systemctl status libvirtd.service
649 cd /etc/sysconfig/network-scripts
650 ls
651 rpm -qa | grep libvirt
652 yum -y install libvirt
653 brctl show
654 ifconfig
655 brctl show
656 brctl add virbr0
657 brctl addbr virbr0
658 ifconfig virbr0 up
659 ifconfig
660 systemctl status firewalld
661 reboot
662 ps aux
663 ifconfig
664 netstat -ntlp |grep 22
665 curl -vvv https://localhost:443
666 curl -vvv https://localhost:6443
667 curl -vvv http://localhost:32567
668 kubectl get svc -n default
669 kubectl get svc -n kube-system
670 curl -vvv http://10.96.165.159:32567
671 curl -vvv http://10.96.165.159:88
672 kubectl get svc -n kube-system
673 kubectl get pod -n kube-system
674 kubectl logs kuboard-6948759c89-hgnqq
675 kubectl logs kuboard-6948759c89-hgnqq -n kube-system
676 echo ${KUBE_DNS_SERVICE_HOST}
677 kubectl delete pod metrics-server-5bd664ff57-cdqnp -n kube-system
678 kubectl get pod -n kube-system
679 kubectl logs metrics-server-5bd664ff57-ss4cz -n kube-system
680 kubectl get pod -n kube-system
681 kubectl logs kuboard-6948759c89-hgnq -n kube-system
682 kubectl get pod -n kube-system
683 kubectl logs kuboard-6948759c89-hgnqq -n kube-system
684 kubectl get pod -n kube-system
685 kubectl delete pod etcd-master1 -n kube-system
686 kubectl get pod -n kube-system
687 kubectl get pod -n default
688 ls
689 kubectl delete -f kuboard.yaml
690 kubectl apply -f kuboard.yaml
691 kubectl get pod -n kube-system
692 kubectl delete pod kuboard-6948759c89-hgnqq -n kube-system
693 kubectl get pod -n kube-system
694 ifconfig
695 netstat -anp
696 netstat -anp|grep 32006
697 netstat -anp|grep 32567
698 history |grep kube-proxy
699 kubectl get pod -n kube-system |grep kube-proxy |awk '{print $1}' |xargs kubectl delete pod -n kube-system
700 systemctl restart kubelet
701 systemctl restart docker
702 vi kuboard.yaml
703 history|grep kubeadm
704 kubeadm reset
705 kubeadm init
706 docker images
707 swapoff -a
708 cd /etc/sysctl.d/
709 ls
710 vi 99-sysctl.conf
711 kubeadm init --apiserver-advertise-address=10.21.232.4 --image-repository registry.aliyuncs.com/google_containers
712 kubeadm init --apiserver-advertise-address=10.21.232.4 --image-repository=registry.aliyuncs.com/google_containers
713 kubeadm init --image-repository=registry.aliyuncs.com/google_containers
714 docker images
715 history |grep kubeadm
716 history |grep init
717 curl -sSL https://kuboard.cn/install-script/v1.16.2/init_master.sh | sh
718 export APISERVER_NAME=apiserver.dml
719 POD_SUBNET=10.100.0.1/16
720 curl -sSL https://kuboard.cn/install-script/v1.16.2/init_master.sh | sh
721 export POD_SUBNET=10.100.0.1/16
722 curl -sSL https://kuboard.cn/install-script/v1.16.2/init_master.sh | sh
723 kubectl get pod -n kube-system
724 kubeadm init
725 netstat -ntlp |grep 6443
726 kill -9 7670
727 netstat -ntlp |grep 10251
728 kill -9 7678
729 netstat -ntlp |grep 10252
730 kill -9 7640
731 netstat -ntlp |grep 10252
732 kubeadm init
733 kubeadm reset
734 curl -sSL https://kuboard.cn/install-script/v1.16.2/init_master.sh | sh
735 kubectl get pod -n kube-system
736 cd ~
737 kubectl get pod -n kube-system
738 kubectl delete -f kuboard.yaml
739 kubectl apply -f kuboard.yaml
740 kubectl get pod -n kube-system
741 kubectl apply -f metrics-server.tar
742 kubectl get pod -n kube-system
743 ls
744 vi kubeadm-config.yaml
745 vi metrics-server.yaml
746 kubectl apply -f metrics-server.yaml
747 kubectl get pod -n kube-system
748 netstat -ntlp |grep 32567
749 curl -vvv http://localhost:32567
750 history |grep initial-setup-ks.cfg
751 history |grep init
752 kubeadm reset
753 curl -sSL https://kuboard.cn/install-script/v1.16.2/init_master.sh | sh
754 mkdir -p $HOME/.kube
755 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
756 sudo chown $(id -u):$(id -g) $HOME/.kube/config
757 history|grep 16.2
758 history
759 kubeadm init
760 kubectl get pod -n kube-system
761 netstat -ntlp |grep 32567
762 kubectl apply -f kuboard.yaml
763 netstat -ntlp |grep 32567
764 telnet 127.0.0.1 32567
765 kubectl get pod -n kube-system
766 kubectl logs kuboard-6948759c89-qb9qq -n kube-system
767 vi kuboard.yaml
768 telnet 127.0.0.1 32567
769 curl -vvv http://127.0.0.1:32567
770 kubectl delete -f kuboard.yaml
771 ls
772 kubeadm init --config=./kubeadm-config.yaml
773 kubeadm reset
774 kubeadm init --config=./kubeadm-config.yaml
775 kubectl apply -f kuboard.yaml
776 netstat -ntlp|grep 32567
777 ls
778 kubectl get pod -n kube-system
779 mkdir -p $HOME/.kub
780 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
781 sudo chown $(id -u):$(id -g) $HOME/.kube/config
782 kubectl apply -f kuboard.yaml
783 netstat -ntlp|grep 32567
784 curl -vvv http://localhost:32567
785 kubectl apply -f metrics-server.yaml
786 kubectl get pod -n kube-system
787 kubectl logs kuboard-6948759c89-5t4db -n kube-system
788 kubectl describe pod kuboard-6948759c89-5t4db -n kube-system
789 ls
790 kubectl get pod -n kube-system
791 kubectl apply -f calico-3.9.2.yaml
792 kubectl get pod -n kube-system
793 curl -vvv http://localhost:32567
794 kubectl describe pod kuboard-6948759c89-5t4db -n kube-system
795 kubectl get pod -n kube-system
796 kubectl delete pod kuboard-6948759c89-5t4db -n kube-system
797 kubectl describe pod kuboard-6948759c89-5t4db -n kube-system
798 kubectl get pod -n kube-system
799 kubectl describe pod kuboard-6948759c89-khxs4 -n kube-system
800 curl -vvv http://localhost:32567
801 vi kuboard.yaml
802 kubectl delete -f kuboard.yaml
803 kubectl apply -f kuboard.yaml
804 kubectl get pod -n kube-system
805 kubectl describe pod kuboard-6948759c89-dln5q -n kube-system
806 kubectl get pod -n kube-system
807 telnet 127.0.0.1 32567
808 history|grep echo
809 echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-user | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
810 kubectl get pod -n kube-system
811 kubectl delete -f metrics-server.yaml
812 kubectl apply -f metrics-server.yaml
813 kubectl get pod -n kube-system
814 kubectl describe pod metrics-server-78664db96b-nrqgb -n kube-system
815 kubectl describe nodes master1 | grep Taints
816 kubectl taint node master1 node-role.kubernetes.io/master:NoSchedule-
817 kubectl get pod -n kube-system
818 kubectl delete pod metrics-server-78664db96b-nrqgb -n kube-system
819 kubectl get pod -n kube-system
820 kubectl describe pod metrics-server-78664db96b-9lm6l -n kube-system
821 kubectl logs metrics-server-78664db96b-9lm6l -n kube-system
822 kubectl logs metrics-server-78664db96b-9lm6l -n kube-system
823 kubectl get pod -n kube-system
824 kubectl describe pod metrics-server-78664db96b-9lm6l -n kube-system
825 vi metrics-server.yaml
826 netstat -ntlp |grep 4443
827 kubectl get pod -n kube-system
828 kubectl delete pod metrics-server-78664db96b-9lm6l -n kube-system
829 kubectl get pod -n kube-system
830 kubectl describe pod metrics-server-78664db96b-xwbxk -n kube-system
831 netstat -ntlp |grep 443
832 kubectl apply -f metrics-server.yaml
833 kubectl get pod -n kube-system
834 kubectl describe pod metrics-server-78664db96b-2srwt -n kube-system
835 kubectl get pod -n kube-system
836 kubectl describe pod metrics-server-78664db96b-2srwt -n kube-system
837 kubectl delete pod metrics-server-78664db96b-2srwt -n kube-system
838 kubectl get pod -n kube-system
839 kubectl describe pod metrics-server-78664db96b-2srwt -n kube-system
840 kubectl describe pod metrics-server-78664db96b-cmdft -n kube-system
841 kubectl get deployment -n kube-system
842 kubectl delete deployment metrics-server -n kube-system
843 kubectl get pod -n kube-system
844 history|grep join
845 kubeadm token create --print-join-command
846 docker images
847 kubectl get pod -n kube-system
848 kubectl describe pod metrics-server-5d7cb47f9d-7wcjp -n kube-system
849 kubectl get pod -n kube-system
850 kubectl get nodes
851 docker images
852 kubectl get pod -n kube-system
853 kubectl get pod -n default
854 kubectl describe pod eureka-8564c6bd85-zvfjt -n default
855 kubectl get pod -n default
856 kubectl describe pod svc-config-7ddc5d758d-wzdrz -n default
857 kubectl get pod -n default
858 docker images
859 kubectl get pod -n default
860 kubectl describe pod gateway2-5f57f88747-kbxfs -n default
861 docker images
862 kubectl get pod -n default
863 kubectl delete pod base-service-66689c5459-8zxzk -n kube-system
864 kubectl delete pod base-service-66689c5459-8zxzk -n default
865 kubectl get pod -n default
866 kubectl delete pod green-59d6798cb5-s4kkl -n default
867 kubectl describe pod base-service-66689c5459-8q52m -n default
868 kubectl get pod -n default
869 kubectl describe pod green-59d6798cb5-xlzx2 -n default
870 kubectl describe pod base-service-66689c5459-8q52m -n default
871 kubectl logs base-service-66689c5459-8q52m -n default
872 kubectl get svc -n default
873 kubectl logs base-service-66689c5459-8q52m -n default
874 kubectl get svc -n default
875 kubectl get pod -n default
876 kubectl logs gateway2-676b78458-gcvv4 -n default
877 kubectl get pod -n default
878 kubectl logs svc-config-7ddc5d758d-wzdrz -n default
879 kubectl get pod -n default
880 kubectl logs eureka-8564c6bd85-zvfjt -n default
881 kubectl get pod -n default
882 kubectl logs green-7484d588cb-k8ppg -n default
883 cd /green/project/config
884 ls
885 vi application-prod.yaml
886 vi application.yaml
887 kubectl get pod -n default
888 kubectl logs gateway2-6586589df8-gd9kd -n default
889 kubectl logs green-7484d588cb-k8ppg -n default
890 kubectl get pod -n default
891 kubectl logs svc-config-7c76849c9-gtf4j -n default
892 kubectl get pod -n default
893 kubectl logs svc-config-7c76849c9-gtf4j -n default
894 kubectl get pod -n default
895 kubectl logs auth-service-6954dd8558-2khwn -n default
896 kubectl get pod -n default
897 kubectl logs base-service-86b5d679dc-92xn8 -n default
898 kubectl get pod -n default
899 kubectl logs db-mysql-796d866db5-jxj4k -n default
900 kubectl get pod -n default
901 kubectl logs eureka-8564c6bd85-zvfjt -n default
902 kubectl get pod -n default
903 kubectl logs gateway2-6586589df8-gd9kd -n default
904 kubectl get pod -n default
905 kubectl logs green-7484d588cb-k8ppg -n default
906 kubectl get pod -n default
907 kubectl logs nginx-5fc9f8b86b-2b9xv -n default
908 kubectl get pod -n default
909 free -h
910 history
911 history|grep echo
912 echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-user | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
913 ls
914 docker images
915 ls
916 cd /
917 ls
918 cd green/
919 ls
920 cd log/
921 ls
922 cd ..
923 ls
924 cd project/
925 ls
926 kubectl get pod -n default
927 kubectl logs green-7484d588cb-k8ppg > green_new_log.log
928 ls
929 netstat -ntplu
930 netstat -ntplu|grep 32567
931 systemctl status firewalld.service
932 i pa
933 ip a
934 telnet 10.21.232.4 32567
935 cat /etc/centos-release
936 cd /mnt/
937 ls
938 cd /
939 mount /dev/sr0 /mnt/
940 cd /mnt/
941 ls
942 cd /
943 umount /dev/sr0
944 mount /dev/sr0 /mnt/
945 cd /mnt/
946 ls
947 cd Packages/
948 rpm -ivh telnet-0.17-64.el7.x86_64.rpm
949 cd /
950 umount /dev/sr0
951 telnet 10.21.232.4 32567
952 history
953 history
954 curl -vvv http://localhost:32567
955 telnet 10.21.232.4 32567
956 kubectl get pod -n default
957 kubectl logs eureka-7455bbb676-mqgjt -n default
958 ping 10.96.253.199
959 telnet 10.96.25.196
960 ls
961 kubectl get pods -o wide
962 kubectl logs eureka-5b855b6fc5-fr95h
963 kubectl get pod eureka-5b855b6fc5-fr95h -n default
964 ifconfig
965 history|grep join
966 kubeadm token create --print-join-command
967 kubectl get pod -n default
968 kubectl describe pod eureka-5b855b6fc5-fr95h -n default
969 kubectl describe pod svc-config-64b9bb9f65-9v9xk -n default
970 kubectl logs pod eureka-5b855b6fc5-fr95h -n default
971 kubectl logs eureka-5b855b6fc5-fr95h -n default
972 ifconfig
973 get svc -n default |grep dns
974 get svc -n default
975 kubectl get svc -n default
976 kubectl get svc -n kube-system
977 docker exec -it eureka /bin/bash
978 kubectl describ pod svc-config
979 kubectl describe pod svc-config
980 kubectl exec svc-config --ifconfig
981 kubectl exec svc-config -- ifconfig
982 kubectl exec svc-config ifconfig
983 kubectl get pod -n default
984 kubectl logs eureka-5b855b6fc5-fr95h
985 kubectl get pod -n default
986 kubectl logs eureka-5b855b6fc5-fr95h
987 kubectl get svc -n default
988 kubectl get pod
989 kubectl logs eureka-7b69558dbf-btmb5
990 cd /usr/local/dbappsecurity/edr/
991 sh uninstall_edr.sh
992
993 cd /opt/ah
994 wget --no-check-certificate http://59.231.8.246:10571/download/linux/SZWYEDR/59.231.8.246_10571/1/agent_setup.sh -O agent_setup.sh && chmod +x agent_setup.sh && ./agent_setup.sh
995 wget --no-check-certificate http://59.231.10.212:10571/download/linux/SZWYEDR/59.231.10.212_10571/1/agent_setup.sh -O agent_setup.sh && chmod +x agent_setup.sh && ./agent_setup.sh
996 watch kubectl get pod -n kube-system -o wide
997 kubectl get nodes
998 hostnamectl status
999 history
K8S配置备份
为了更好的理解K8S,把导出的备份也记录一下。文件命名格式为:kuboard_default_xxx.yaml xxx默认为日期,我个人是增加了一些中文,便于文件查找
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: auth-service
annotations:
k8s.kuboard.cn/workload: auth-service
deployment.kubernetes.io/revision: '1'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: ClusterIP
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: auth-service
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: auth-service
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: auth-service
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'auth-service:v1.0'
imagePullPolicy: Never
name: auth-service
volumeMounts:
- name: logback
mountPath: /log/logback-spring.xml
- name: logs-dir
mountPath: /logs
- name: upload-dir
mountPath: /upload
resources:
limits:
requests:
env:
- name: eureka_zone
value: 'http://eureka:9001/eureka'
- name: spring.profiles.active
value: 'prod,native'
- name: config_uri
value: 'http://svc-config:9000'
- name: TZ
value: Asia/Shanghai
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: logback
hostPath:
path: /green/project/logback-spring.xml
type: File
- name: logs-dir
hostPath:
path: /green/log
type: Directory
- name: upload-dir
hostPath:
path: /green/project/upload
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: auth-service
annotations:
k8s.kuboard.cn/workload: auth-service
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: auth-service
spec:
selector:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: auth-service
type: ClusterIP
ports:
- port: 9003
targetPort: 9003
protocol: TCP
name: bef7xf
nodePort: 0
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: base-service
annotations:
k8s.kuboard.cn/workload: base-service
deployment.kubernetes.io/revision: '3'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: ClusterIP
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: base-service
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: base-service
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: base-service
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'base-service:v1.3'
imagePullPolicy: Never
name: base-service
volumeMounts:
- name: logback
mountPath: /log/logback-spring.xml
- name: log-dir
mountPath: /logs
- name: upload-dir
mountPath: /upload
resources:
limits:
requests:
env:
- name: eureka_zone
value: 'http://eureka:9001/eureka'
- name: spring.profiles.active
value: 'prod,native'
- name: config_uri
value: 'http://svc-config:9000'
- name: TZ
value: Asia/Shanghai
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: logback
hostPath:
path: /green/project/logback-spring.xml
type: File
- name: log-dir
hostPath:
path: /green/log
type: Directory
- name: upload-dir
hostPath:
path: /green/project/upload
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
nodeName: node1
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: base-service
annotations:
k8s.kuboard.cn/workload: base-service
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: base-service
spec:
selector:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: base-service
type: ClusterIP
ports:
- port: 9004
targetPort: 9004
protocol: TCP
name: xesxem
nodePort: 0
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: db-mysql
annotations:
k8s.kuboard.cn/workload: db-mysql
deployment.kubernetes.io/revision: '1'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: NodePort
labels:
k8s.kuboard.cn/layer: db
k8s.kuboard.cn/name: db-mysql
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: db
k8s.kuboard.cn/name: db-mysql
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: db
k8s.kuboard.cn/name: db-mysql
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'mysql:5.7'
imagePullPolicy: Never
name: db-mysql
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
resources:
limits:
requests:
env:
- name: root
value: ghhbasjkdasdbadnlk1jkj12bankalsdnlfb
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: mysql-data
hostPath:
path: /green/db/mysqldata
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
nodeName: master1
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: db-mysql
annotations:
k8s.kuboard.cn/workload: db-mysql
labels:
k8s.kuboard.cn/layer: db
k8s.kuboard.cn/name: db-mysql
spec:
selector:
k8s.kuboard.cn/layer: db
k8s.kuboard.cn/name: db-mysql
type: NodePort
ports:
- port: 3306
targetPort: 3306
protocol: TCP
name: yfwxej
nodePort: 32206
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: eureka
annotations:
k8s.kuboard.cn/workload: eureka
deployment.kubernetes.io/revision: '3'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: ClusterIP
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: eureka
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: eureka
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: eureka
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'eureka:v1.0'
imagePullPolicy: Never
name: eureka
volumeMounts:
- name: logback
mountPath: /log/logback-spring.xml
- name: log-dir
mountPath: /logs
resources:
limits:
requests:
env:
- name: spring.profiles.active
value: 'prod,native'
- name: TZ
value: Asia/Shanghai
- name: config_uri
value: 'http://svc-config:9000'
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: logback
hostPath:
path: /green/project/logback-spring.xml
type: File
- name: log-dir
hostPath:
path: /green/log
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
nodeName: master3
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: eureka
annotations:
k8s.kuboard.cn/workload: eureka
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: eureka
spec:
selector:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: eureka
type: ClusterIP
ports:
- port: 9001
targetPort: 9001
protocol: TCP
name: fagtgp
nodePort: 0
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: gateway2
annotations:
k8s.kuboard.cn/workload: gateway2
deployment.kubernetes.io/revision: '4'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: NodePort
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: gateway2
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: gateway2
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: gateway2
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'gateway:v1.0'
imagePullPolicy: Never
name: gateway2
volumeMounts:
- name: logback
mountPath: /log/logback-spring.xml
- name: log-dir
mountPath: /logs
- name: upload-dir
mountPath: /upload
resources:
limits:
requests:
env:
- name: eureka_zone
value: 'http://eureka:9001/eureka'
- name: spring.profiles.active
value: 'prod,native'
- name: config_uri
value: 'http://svc-config:9000'
- name: TZ
value: Asia/Shanghai
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: logback
hostPath:
path: /green/project/logback-spring.xml
type: File
- name: log-dir
hostPath:
path: /green/log
type: Directory
- name: upload-dir
hostPath:
path: /green/project/upload
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: gateway2
annotations:
k8s.kuboard.cn/workload: gateway2
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: gateway2
spec:
selector:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: gateway2
type: NodePort
ports:
- port: 8080
targetPort: 8080
protocol: TCP
name: jjdyak
nodePort: 32006
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: green
annotations:
k8s.kuboard.cn/workload: green
deployment.kubernetes.io/revision: '4'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: ClusterIP
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: green
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: green
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: green
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'green:v2.0'
imagePullPolicy: Never
name: green
volumeMounts:
- name: logback
mountPath: /log/logback-spring.xml
- name: log-dir
mountPath: /logs
- name: upload-dir
mountPath: /upload
resources:
limits:
requests:
env:
- name: eureka_zone
value: 'http://eureka:9001/eureka'
- name: spring.profiles.active
value: 'prod,native'
- name: config_uri
value: 'http://svc-config:9000'
- name: TZ
value: Asia/Shanghai
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: logback
hostPath:
path: /green/project/logback-spring.xml
type: File
- name: log-dir
hostPath:
path: /green/log
type: Directory
- name: upload-dir
hostPath:
path: /green/project/upload
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
nodeName: node2
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: green
annotations:
k8s.kuboard.cn/workload: green
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: green
spec:
selector:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: green
type: ClusterIP
ports:
- port: 9023
targetPort: 9023
protocol: TCP
name: 3ftmxh
nodePort: 0
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: nginx
annotations:
k8s.kuboard.cn/workload: nginx
deployment.kubernetes.io/revision: '3'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: NodePort
labels:
k8s.kuboard.cn/layer: web
k8s.kuboard.cn/name: nginx
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: web
k8s.kuboard.cn/name: nginx
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: web
k8s.kuboard.cn/name: nginx
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'nginx:1.8'
imagePullPolicy: Never
name: nginx
volumeMounts:
- name: main-config
mountPath: /etc/nginx/nginx.conf
- name: config-dir
mountPath: /etc/nginx/conf.d
- name: cert-dir
mountPath: /etc/nginx/cert
- name: log-dir
mountPath: /logs
- name: html-dir
mountPath: /html
resources:
limits:
requests:
env: []
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: main-config
hostPath:
path: /green/project/nginx/nginx.conf
type: File
- name: config-dir
hostPath:
path: /green/project/nginx/conf.d
type: Directory
- name: cert-dir
hostPath:
path: /green/project/nginx/cert
type: Directory
- name: log-dir
hostPath:
path: /green/log
type: Directory
- name: html-dir
hostPath:
path: /green/project/html
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
nodeName: master1
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: nginx
annotations:
k8s.kuboard.cn/workload: nginx
labels:
k8s.kuboard.cn/layer: web
k8s.kuboard.cn/name: nginx
spec:
selector:
k8s.kuboard.cn/layer: web
k8s.kuboard.cn/name: nginx
type: NodePort
ports:
- port: 80
targetPort: 80
protocol: TCP
name: 7jgjyj
nodePort: 30081
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: redis
annotations:
k8s.kuboard.cn/workload: redis
deployment.kubernetes.io/revision: '1'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: ClusterIP
labels:
k8s.kuboard.cn/layer: cloud
k8s.kuboard.cn/name: redis
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: cloud
k8s.kuboard.cn/name: redis
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: cloud
k8s.kuboard.cn/name: redis
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'redis:5.0.8'
imagePullPolicy: Never
name: redis
volumeMounts:
- name: redis-conf
mountPath: /etc/redis.conf
- name: redis-data
mountPath: /data
command:
- redis-server
args:
- /etc/redis.conf
resources:
limits:
requests:
env:
- name: password
value: dmaier@
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: redis-conf
hostPath:
path: /green/db/redisdata/redis.conf
type: File
- name: redis-data
hostPath:
path: /green/db/redisdata
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
nodeName: master2
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: redis
annotations:
k8s.kuboard.cn/workload: redis
labels:
k8s.kuboard.cn/layer: cloud
k8s.kuboard.cn/name: redis
spec:
selector:
k8s.kuboard.cn/layer: cloud
k8s.kuboard.cn/name: redis
type: ClusterIP
ports:
- port: 6379
targetPort: 6379
protocol: TCP
name: xq3fnq
nodePort: 0
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: svc-config
annotations:
k8s.kuboard.cn/workload: svc-config
deployment.kubernetes.io/revision: '2'
k8s.kuboard.cn/ingress: 'false'
k8s.kuboard.cn/service: ClusterIP
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: svc-config
spec:
selector:
matchLabels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: svc-config
revisionHistoryLimit: 10
template:
metadata:
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: svc-config
spec:
securityContext:
seLinuxOptions: {}
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'config-server:v1.0'
imagePullPolicy: Never
name: config
volumeMounts:
- name: logging-config
mountPath: /log/logback-spring.xml
- name: log-dir
mountPath: /logs
- name: base-config
mountPath: /application-prod.yaml
- name: config-dir
mountPath: /config
resources:
limits:
requests:
env:
- name: spring.profiles.active
value: 'prod,native'
- name: TZ
value: Asia/Shanghai
- name: eureka_zone
value: 'http://eureka:9001/eureka'
lifecycle: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: logging-config
hostPath:
path: /green/project/logback-spring.xml
type: File
- name: log-dir
hostPath:
path: /green/log
type: Directory
- name: base-config
hostPath:
path: /green/project/config-service/application-prod.yaml
type: File
- name: config-dir
hostPath:
path: /green/project/config
type: Directory
dnsPolicy: ClusterFirst
dnsConfig: {}
schedulerName: default-scheduler
nodeName: master2
terminationGracePeriodSeconds: 30
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: svc-config
annotations:
k8s.kuboard.cn/workload: svc-config
labels:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: svc-config
spec:
selector:
k8s.kuboard.cn/layer: svc
k8s.kuboard.cn/name: svc-config
type: ClusterIP
ports:
- port: 9000
targetPort: 9000
protocol: TCP
name: eh3j52
nodePort: 0
sessionAffinity: None
结束语
作为一个研发技术,多多少少都会跟运维打交道,即使不参与运维,也应该懂一些运维的基本常识,在工作中能够更加顺利的完成好领导交代的工作任务。
K8S是一个比较大型的运维管理工具,其优点在于对服务器进行集群,对各个微服务进行部署、负载均衡、版本控制等操作都及其简便。 但缺点也存在一些,比如学习门槛高,难于上手,证书每年一换,到了时间就要再重新弄一下证书,甚至要重新再部署一遍。 还有的时候电压不稳也会导致某些服务停止运行,需要人为地进行重启等等。
虽然用的可能不太多,目前还是先保存一下,也许将来能用得上。
欢迎大家多多关注和支持! 我们一直会保持不定期更新,绝对不会放弃,让我们都遇到更好的自己!