Newer
Older
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
<!DOCTYPE html>
<html>
<head>
<title>1.6.KSB_K8s_install_Guide</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="file:////home/csle/.atom/packages/markdown-preview-enhanced/node_modules/@shd101wyy/mume/dependencies/katex/katex.min.css">
<style>
/**
* prism.js Github theme based on GitHub's theme.
* @author Sam Clarke
*/
code[class*="language-"],
pre[class*="language-"] {
color: #333;
background: none;
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.4;
-moz-tab-size: 8;
-o-tab-size: 8;
tab-size: 8;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* Code blocks */
pre[class*="language-"] {
padding: .8em;
overflow: auto;
/* border: 1px solid #ddd; */
border-radius: 3px;
/* background: #fff; */
background: #f5f5f5;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
background: #f5f5f5;
}
.token.comment,
.token.blockquote {
color: #969896;
}
.token.cdata {
color: #183691;
}
.token.doctype,
.token.punctuation,
.token.variable,
.token.macro.property {
color: #333;
}
.token.operator,
.token.important,
.token.keyword,
.token.rule,
.token.builtin {
color: #a71d5d;
}
.token.string,
.token.url,
.token.regex,
.token.attr-value {
color: #183691;
}
.token.property,
.token.number,
.token.boolean,
.token.entity,
.token.atrule,
.token.constant,
.token.symbol,
.token.command,
.token.code {
color: #0086b3;
}
.token.tag,
.token.selector,
.token.prolog {
color: #63a35c;
}
.token.function,
.token.namespace,
.token.pseudo-element,
.token.class,
.token.class-name,
.token.pseudo-class,
.token.id,
.token.url-reference .token.variable,
.token.attr-name {
color: #795da3;
}
.token.entity {
cursor: help;
}
.token.title,
.token.title .token.punctuation {
font-weight: bold;
color: #1d3e81;
}
.token.list {
color: #ed6a43;
}
.token.inserted {
background-color: #eaffea;
color: #55a532;
}
.token.deleted {
background-color: #ffecec;
color: #bd2c00;
}
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
/* JSON */
.language-json .token.property {
color: #183691;
}
.language-markup .token.tag .token.punctuation {
color: #333;
}
/* CSS */
code.language-css,
.language-css .token.function {
color: #0086b3;
}
/* YAML */
.language-yaml .token.atrule {
color: #63a35c;
}
code.language-yaml {
color: #183691;
}
/* Ruby */
.language-ruby .token.function {
color: #333;
}
/* Markdown */
.language-markdown .token.url {
color: #795da3;
}
/* Makefile */
.language-makefile .token.symbol {
color: #795da3;
}
.language-makefile .token.variable {
color: #183691;
}
.language-makefile .token.builtin {
color: #0086b3;
}
/* Bash */
.language-bash .token.keyword {
color: #0086b3;
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% - 300px);padding:2em calc(50% - 457px - 150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
/* Please visit the URL below for more information: */
/* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
</style>
</head>
<body for="html-export">
<div class="mume markdown-preview ">
<h1 class="mume-header" id="kubernetes-%ED%81%B4%EB%9F%AC%EC%8A%A4%ED%84%B0-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">Kubernetes 클러스터 설치하기</h1>
<hr>
<p>3대 서버에 마스터 1개, 노드1, 노도2의 쿠버네티스 클러스터를 구성하기 위한 설치 방법을 설명합니다.<br>
각 서버의 호스트 이름 및 IP 는 아래와 같이 가정합니다. 사용자의 클러스터 환경에 맞게 IP를 수정하시기 바랍니다.<br>
csle1 : 192.168.0.5 (master)<br>
csle2 : 192.168.0.6 (node1)<br>
csle3 : 192.168.0.7 (node2)</p>
<h2 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84%EC%97%90-%EA%B3%B5%ED%86%B5%EC%9C%BC%EB%A1%9C-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">모든 서버에 공통으로 설치하기</h2>
<h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-java-8-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] java 8 설치하기</h3>
<p><a href="https://csleoss.etri.re.kr/images/contents/manual_1.0/1.2.HowToInstallKsbToolBox.html#host-pc-java-8-oracle-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0" title="KSB 툴박스 설치">KSB 툴박스 설치</a>의 java-8-oracle 설치 부분을 참고합니다.</p>
<h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-%EA%B8%B0%ED%83%80-%EC%9A%B0%EB%B6%84%ED%88%AC-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] 기타 우분투 프로그램 설치하기</h3>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">apt-get</span> update <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> -y python-software-properties <span class="token operator">&&</span> \
<span class="token function">sudo</span> add-apt-repository -y ppa:webupd8team/java <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> update <span class="token operator">&&</span> \
<span class="token keyword">echo</span> <span class="token string">"oracle-java8-installer \
shared/accepted-oracle-license-v1-1 select true"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> debconf-set-selections <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> -y oracle-java8-installer
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-sshd-port-%EB%B3%80%EA%B2%BD-%EB%B0%8F-root-%EB%A1%9C%EA%B7%B8%EC%9D%B8-%EA%B0%80%EB%8A%A5%ED%95%98%EA%B2%8C-sshd-config-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] SSHD port 변경 및 root 로그인 가능하게 SSHD config 수정하기</h3>
<p>아래의 명령을 수행하여 포트 정보를 2243로 수정하고, root 로그인을 허용합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">sed</span> -ri <span class="token string">'s/^Port 22/Port 2243/g'</span> /etc/ssh/sshd_config
<span class="token function">sudo</span> <span class="token function">sed</span> -ri \
<span class="token string">'s/^PermitRootLogin prohibit-password/PermitRootLogin yes/g'</span> \
/etc/ssh/sshd_config
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-ssh-config-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] SSH config 수정하기</h3>
<p>SSH 접속시 known_hosts에 호스트 정보 저장 질문을 하지 않도록 설정합니다.<br>
아래의 명령을 수행하여 ssh_config의 기존 내용을 모두 삭제하고 설정을 추가합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> truncate -s0 /etc/ssh/ssh_config
<span class="token keyword">echo</span> <span class="token string">"Host localhost"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"StrictHostKeyChecking no"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"Host 0.0.0.0"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"StrictHostKeyChecking no"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"Host 127.0.0.1"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"StrictHostKeyChecking no"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"Host csle*"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"StrictHostKeyChecking no"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"UserKnownHostsFile=/dev/null"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"Host master"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"StrictHostKeyChecking no"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token keyword">echo</span> <span class="token string">"UserKnownHostsFile=/dev/null"</span> \
<span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> -a /etc/ssh/ssh_config <span class="token operator">></span>/dev/null
<span class="token function">sudo</span> <span class="token function">service</span> <span class="token function">ssh</span> restart
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-ssh-%EC%84%9C%EB%B9%84%EC%8A%A4-%EC%9E%AC%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0">[모든 서버 공통] SSH 서비스 재시작하기</h3>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">service</span> <span class="token function">ssh</span> restart
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-docker-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] docker 설치하기</h3>
<p>아래의 명령으로 docker-ce을 설치합니다. 현재 최신 버전은 18.06.1~ce~3-0~ubuntu 입니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">curl</span> -fsSL https://download.docker.com/linux/ubuntu/gpg <span class="token operator">|</span> \
<span class="token function">sudo</span> apt-key add - <span class="token operator">&&</span> \
<span class="token function">sudo</span> add-apt-repository \
<span class="token string">"deb [arch=amd64]
https://download.docker.com/linux/ubuntu <span class="token variable"><span class="token variable">$(</span>lsb_release -cs<span class="token variable">)</span></span> stable"</span> <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> update <span class="token operator">&&</span> \
apt-cache policy docker-ce <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> -y docker-ce<span class="token operator">=</span>18.06.1~ce~3-0~ubuntu <span class="token operator">&&</span> \
<span class="token function">sudo</span> systemctl status docker
</pre><h4 class="mume-header" id="%EC%B0%B8%EA%B3%A0%EC%82%AC%ED%95%AD-%EA%B8%B0%EC%A1%B4-docker-engine-%EC%82%AD%EC%A0%9C">[참고사항] 기존 docker-engine 삭제</h4>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">apt-get</span> purge -y docker docker-engine docker.io
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-docker-sudo-%EB%AA%85%EB%A0%B9%EC%97%86%EC%9D%B4-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-%EC%9C%84%ED%95%9C-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] docker sudo 명령없이 사용하기 위한 설정하기</h3>
<p>Docker 명령시 root 권한이 필요합니다. root가 아닌 사용자가 sudo 없이 사용하려면 해당 사용자를 docker 그룹에 추가합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">usermod</span> -aG docker csle
<span class="token comment"># 사용자가 로그인 중이라면 다시 로그인 후 권한이 적용됩니다.</span>
<span class="token comment"># 단, 현재 터미널에서만 적용됩니다.</span>
<span class="token function">sudo</span> <span class="token function">su</span> csle
PC 재부팅
</pre><p>PC 재부팅을 통해서 sudo 명령없이 docker 명령을 사용할 수 있습니다.</p>
<h2 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-nvidia-docker-20-%EC%84%A4%EC%B9%98">[모든 서버 공통] nvidia-docker 2.0 설치</h2>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">curl</span> -s -L https://nvidia.github.io/nvidia-docker/gpgkey <span class="token operator">|</span> \
<span class="token function">sudo</span> apt-key add - <span class="token operator">&&</span> \
<span class="token function">curl</span> -s -L \
https://nvidia.github.io/nvidia-docker/\
ubuntu16.04/amd64/nvidia-docker.list <span class="token operator">|</span> \
<span class="token function">sudo</span> <span class="token function">tee</span> /etc/apt/sources.list.d/nvidia-docker.list <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> update <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> -y nvidia-docker2 <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">pkill</span> -SIGHUP dockerd
</pre><p>아래의 질의에 대해서 Y를 누르면 설치가 완료됩니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">Configuration <span class="token function">file</span> <span class="token string">'/etc/docker/daemon.json'</span>
<span class="token operator">==</span><span class="token operator">></span> File on system created by you or by a script.
<span class="token operator">==</span><span class="token operator">></span> File also <span class="token keyword">in</span> package provided by package maintainer.
어떻게 하시겠습니까? 다음 중에 하나를 선택할 수 있습니다:
Y 또는 I <span class="token keyword">:</span> 패키지 관리자의 버전을 설치합니다
N 또는 O <span class="token keyword">:</span> 현재 설치된 버전을 유지합니다
D <span class="token keyword">:</span> 버전 간의 차이점을 표시합니다
Z <span class="token keyword">:</span> 프로세스를 백그라운드로 하고 상황을 알아봅니다
기본값으로 현재 버전을 그대로 유지합니다.
*** daemon.json <span class="token punctuation">(</span>Y/I/N/O/D/Z<span class="token punctuation">)</span> <span class="token punctuation">[</span>기본값<span class="token operator">=</span>N<span class="token punctuation">]</span> ? Y
</pre><p>nvidia-docker 버전을 확인합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~$ nvidia-docker version
NVIDIA Docker: 2.0.3
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:24:56 2018
OS/Arch: linux/amd64
Experimental: <span class="token boolean">false</span>
</pre><pre data-role="codeBlock" data-info="sh" class="language-bash">Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 <span class="token punctuation">(</span>minimum version 1.12<span class="token punctuation">)</span>
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:21 2018
OS/Arch: linux/amd64
Experimental: <span class="token boolean">false</span>
</pre><h4 class="mume-header" id="%EC%B0%B8%EA%B3%A0%EC%82%AC%ED%95%AD-%EA%B8%B0%EC%A1%B4-10-%EB%B2%84%EC%A0%84%EC%9D%84-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0-%EC%9C%84%ED%95%B4%EC%84%9C%EB%8A%94-%EC%95%84%EB%9E%98%EC%9D%98-%EB%AA%85%EB%A0%B9%EC%9D%84-%EC%88%98%ED%96%89%ED%95%A9%EB%8B%88%EB%8B%A4">[참고사항] 기존 1.0 버전을 삭제하기 위해서는 아래의 명령을 수행합니다.</h4>
<pre data-role="codeBlock" data-info="sh" class="language-bash">docker volume <span class="token function">ls</span> -q -f driver<span class="token operator">=</span>nvidia-docker <span class="token operator">|</span> \
<span class="token function">xargs</span> -r -I<span class="token punctuation">{</span><span class="token punctuation">}</span> -n1 docker <span class="token function">ps</span> -q -a -f volume<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">}</span> <span class="token operator">|</span> <span class="token function">xargs</span> -r docker <span class="token function">rm</span> -f
<span class="token function">sudo</span> <span class="token function">apt-get</span> purge nvidia-docker
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-kubernetes-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] Kubernetes 설치하기</h3>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">curl</span> -s https://packages.cloud.google.com/apt/doc/apt-key.gpg <span class="token operator">|</span> \
<span class="token function">sudo</span> apt-key add - <span class="token operator">&&</span> \
<span class="token keyword">echo</span> <span class="token string">"deb http://apt.kubernetes.io/ kubernetes-xenial main"</span> <span class="token operator">|</span> \
<span class="token function">sudo</span> <span class="token function">tee</span> /etc/apt/sources.list.d/kubernetes.list <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> update -q <span class="token operator">&&</span> \
<span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> -qy kubelet<span class="token operator">=</span>1.9.6-00 kubectl<span class="token operator">=</span>1.9.6-00 kubeadm<span class="token operator">=</span>1.9.6-00
kubectl version
</pre><h4 class="mume-header" id="%EC%B0%B8%EA%B3%A0%EC%82%AC%ED%95%AD-%EA%B8%B0%EC%A1%B4-kubernetes-%EB%B2%84%EC%A0%84-%EC%82%AD%EC%A0%9C-%EB%B0%A9%EB%B2%95">[참고사항] 기존 Kubernetes 버전 삭제 방법</h4>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">su</span> -
kubeadm reset
<span class="token function">rm</span> /usr/local/bin/kubectl
<span class="token function">rm</span> -r /etc/kubernetes
<span class="token function">rm</span> -r /var/lib/etcd
<span class="token function">rm</span> -rf /var/lib/cni/
<span class="token function">ifconfig</span> cni0 down <span class="token operator">&&</span> ip <span class="token function">link</span> delete cni0
<span class="token function">ifconfig</span> flannel.1 down <span class="token operator">&&</span> ip <span class="token function">link</span> delete flannel.1
<span class="token function">apt-get</span> autoremove --purge -y kubelet kubeadm kubectl kubernetes-cni
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-etcfstab-%EC%88%98%EC%A0%95-%ED%9B%84-%EC%9E%AC%EB%B6%80%ED%8C%85%ED%95%98%EA%B8%B0">[모든 서버 공통] /etc/fstab 수정 후 재부팅하기</h3>
<p>쿠버네티스가 Swap 기능을 관리해야 하므로, 아래의 swap이 적용된 file 시스템 부분을 주석 처리한다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">vi</span> /etc/fstab
UUID<span class="token operator">=</span>c3ec283e-682f-4e8c-b822-43eef87a725f / ext4 errors<span class="token operator">=</span>remount-ro 0 1
<span class="token comment"># /boot/efi was on /dev/nvme0n1p1 during installation</span>
UUID<span class="token operator">=</span>7D67-73C7 /boot/efi vfat umask<span class="token operator">=</span>0077 0 1
<span class="token comment"># swap was on /dev/nvme0n1p3 during installation</span>
<span class="token comment"># (주의!!!) swap 설정 해제</span>
<span class="token comment">#UUID=257a989b-d1fa-4a7c-8ae7-9ccad9b9c0c6 none swap sw 0 0</span>
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-kubernetes-master-etchosts-%EB%B3%80%EA%B2%BD%ED%95%98%EA%B8%B0">[모든 서버 공통] Kubernetes master /etc/hosts 변경하기</h3>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">vi</span> /etc/hosts
127.0.0.1 localhost
<span class="token comment"># 아래 주석처리. Hdfs 연동시 문제가 생김.</span>
<span class="token comment">#127.0.1.1 csle1</span>
<span class="token comment"># The following lines are desirable for IPv6 capable hosts</span>
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
<span class="token comment"># 쿠버네티스 master, node1, node2 정보 등록</span>
192.168.0.5 csle1 master
192.168.0.6 csle2
192.168.0.7 csle3
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-sysctl-kernel-parameter%EA%B0%92-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] sysctl kernel parameter값 수정하기</h3>
<p>커널 차원에서 보안 및 최적화 관련 설정을 변경합니다.</p>
<p>먼저 root계정으로 변경합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~<span class="token comment"># sudo su -</span>
root@csle1:~<span class="token comment">#</span>
</pre><p>아래와 같이 설정 후 반영합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">root@csle1:~<span class="token comment"># vi /etc/sysctl.conf</span>
<span class="token comment"># 아래의 내용을 마지막에 추가합니다.</span>
net.bridge.bridge-nf-call-iptables<span class="token operator">=</span>1
net.bridge.bridge-nf-call-ip6tables<span class="token operator">=</span>1
net.ipv4.ip_forward<span class="token operator">=</span>1
net.netfilter.nf_conntrack_max <span class="token operator">=</span> 786432
root@csle1:~<span class="token comment"># sysctl -p</span>
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-kubectl-%EB%AA%85%EB%A0%B9-%EC%98%B5%EC%85%98%EC%9D%98-%EC%9E%90%EB%8F%99-%EC%99%84%EC%84%B1-%EA%B8%B0%EB%8A%A5-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] kubectl 명령 옵션의 자동 완성 기능 설정하기</h3>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">source</span> /etc/profile.d/bash_completion.sh
<span class="token function">source</span> <span class="token operator"><</span><span class="token punctuation">(</span>kubectl completion bash<span class="token punctuation">)</span>
<span class="token keyword">echo</span> <span class="token string">"source /etc/profile.d/bash_completion.sh"</span> <span class="token operator">|</span> <span class="token function">tee</span> -a ~/.bashrc
<span class="token keyword">echo</span> <span class="token string">"source <(kubectl completion bash)"</span> <span class="token operator">|</span> <span class="token function">tee</span> -a ~/.bashrc
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-security-enhanced-linux-%EB%AA%A8%EB%93%9C-disable-%ED%95%98%EA%B8%B0">[모든 서버 공통] Security Enhanced Linux 모드 disable 하기</h3>
<p>갑작스러운 리부팅 이후에 apiserver, etcd 등이 정상 기동되지 않는 경우가 자주 발생을 막기 위해 permissive로 설정합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">apt <span class="token function">install</span> -y selinux-utils
setenforce 0
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-10-kubeadmconf-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] 10-kubeadm.conf 수정하기</h3>
<p>ExecStart= 위의 라인에 Environment 설정값을 추가합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">root@csle1:~$ <span class="token function">vi</span> /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
<span class="token punctuation">[</span>Service<span class="token punctuation">]</span>
Environment<span class="token operator">=</span><span class="token string">"KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=\
/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=\
/etc/kubernetes/kubelet.conf"</span>
Environment<span class="token operator">=</span><span class="token string">"KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=\
/etc/kubernetes/manifests --allow-privileged=true"</span>
Environment<span class="token operator">=</span><span class="token string">"KUBELET_NETWORK_ARGS=--network-plugin=\
cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"</span>
Environment<span class="token operator">=</span><span class="token string">"KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 \
--cluster-domain=cluster.local"</span>
Environment<span class="token operator">=</span><span class="token string">"KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook \
--client-ca-file=/etc/kubernetes/pki/ca.crt"</span>
Environment<span class="token operator">=</span><span class="token string">"KUBELET_CADVISOR_ARGS=--cadvisor-port=0"</span>
Environment<span class="token operator">=</span><span class="token string">"KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true \
--cert-dir=/var/lib/kubelet/pki"</span>
<span class="token comment"># 아래의 내용을 추가합니다.</span>
Environment<span class="token operator">=</span><span class="token string">"KUBELET_EXTRA_ARGS=--fail-swap-on=false \
--runtime-cgroups=/systemd/system.slice \
--kubelet-cgroups=/systemd/system.slice"</span>
ExecStart<span class="token operator">=</span>
ExecStart<span class="token operator">=</span>/usr/bin/kubelet \
<span class="token variable">$KUBELET_KUBECONFIG_ARGS</span> <span class="token variable">$KUBELET_SYSTEM_PODS_ARGS</span> \
<span class="token variable">$KUBELET_NETWORK_ARGS</span> <span class="token variable">$KUBELET_DNS_ARGS</span> <span class="token variable">$KUBELET_AUTHZ_ARGS</span> \
<span class="token variable">$KUBELET_CADVISOR_ARGS</span> <span class="token variable">$KUBELET_CERTIFICATE_ARGS</span> <span class="token variable">$KUBELET_EXTRA_ARGS</span>
</pre><p>아래의 명령을 통해 kubelet을 재시작 합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">root@csle1:~$ swapoff -a
root@csle1:~$ <span class="token function">sudo</span> systemctl daemon-reload
root@csle1:~$ <span class="token function">sudo</span> systemctl restart kubelet
root@csle1:~$ <span class="token function">sudo</span> systemctl status kubelet
</pre><pre data-role="codeBlock" data-info="sh" class="language-bash">● kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded <span class="token punctuation">(</span>/lib/systemd/system/kubelet.service<span class="token punctuation">;</span> enabled<span class="token punctuation">;</span>
vendor preset: enabled<span class="token punctuation">)</span>
Drop-In: /etc/systemd/system/kubelet.service.d
└─10-kubeadm.conf
Active: activating <span class="token punctuation">(</span>auto-restart<span class="token punctuation">)</span> <span class="token punctuation">(</span>Result: exit-code<span class="token punctuation">)</span> since
수 2018-07-25 09:55:44 KST<span class="token punctuation">;</span> 3s ago
Docs: http://kubernetes.io/docs/
Process: 10517 ExecStart<span class="token operator">=</span>/usr/bin/kubelet <span class="token variable">$KUBELET_KUBECONFIG_ARGS</span>
<span class="token variable">$KUBELET_SYSTEM_PODS_ARGS</span> <span class="token variable">$KUBELET_NETWORK_ARGS</span> <span class="token variable">$KUBELET_DNS_ARGS</span>
<span class="token variable">$KUBELET_AUTHZ_ARGS</span> <span class="token variable">$KUBELET_CADVISOR</span>
Main PID: 10517 <span class="token punctuation">(</span>code<span class="token operator">=</span>exited, status<span class="token operator">=</span>1/FAILURE<span class="token punctuation">)</span>
7월 25 09:55:44 csle4 systemd<span class="token punctuation">[</span>1<span class="token punctuation">]</span>: kubelet.service: Unit entered failed state.
7월 25 09:55:44 csle4 systemd<span class="token punctuation">[</span>1<span class="token punctuation">]</span>: kubelet.service: Failed with result
<span class="token string">'exit-code'</span><span class="token keyword">.</span>
</pre><p>systemctl status kubelet 실행시 status=1/FAILURE로 나타나지만 무시해도 됩니다.<br>
kubeadm이 정상 실행 되면 정상화됩니다.</p>
<p>모든 노드에 대해 동일하게 설정하는 부분을 완료하였습니다.</p>
<p>master와 node들 각각에 대한 설정 방법을 설명합니다.</p>
<h2 class="mume-header" id="kubernetes-master-csle1-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">Kubernetes master (csle1) 설정하기</h2>
<h3 class="mume-header" id="master-csle1-kubeadm-%EC%B4%88%EA%B8%B0%ED%99%94%ED%95%98%EA%B8%B0">[Master: csle1] kubeadm 초기화하기</h3>
<p>자신의 ip에 맞도록 수정하고 kubeadm으로 초기화합니다. (예: master ip : 192.168.0.5)</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">kubeadm init --apiserver-advertise-address<span class="token operator">=</span>192.168.0.5 \
--pod-network-cidr<span class="token operator">=</span>10.244.0.0/16 --service-cidr 10.96.0.0/12 --token-ttl 0
</pre><p>아래와 같은 로그가 나오면서 초기화 되면 정상입니다.</p>
<pre data-role="codeBlock" data-info="" class="language-"><code>[init] Using Kubernetes version: v1.9.9
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks.
[WARNING FileExisting-crictl]: crictl not found in system path
[certificates] Generated ca certificate and key.
[certificates] Generated apiserver certificate and key.
[certificates] apiserver serving cert is signed for DNS names [csle1
kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.
svc.cluster.local] and IPs [10.96.0.1 129.254.xxx.xxx]
[certificates] Generated apiserver-kubelet-client certificate and key.
[certificates] Generated sa key and public key.
[certificates] Generated front-proxy-ca certificate and key.
[certificates] Generated front-proxy-client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "scheduler.conf"
[controlplane] Wrote Static Pod manifest for component kube-apiserver to
"/etc/kubernetes/manifests/kube-apiserver.yaml"
[controlplane] Wrote Static Pod manifest for component kube-controller-manager
to "/etc/kubernetes/manifests/kube-controller-manager.yaml"
[controlplane] Wrote Static Pod manifest for component kube-scheduler to
"/etc/kubernetes/manifests/kube-scheduler.yaml"
[etcd] Wrote Static Pod manifest for a local etcd instance to
"/etc/kubernetes/manifests/etcd.yaml"
[init] Waiting for the kubelet to boot up the control plane as Static Pods
from directory "/etc/kubernetes/manifests".
[init] This might take a minute or longer if the control plane images have
to be pulled.
[apiclient] All control plane components are healthy after 46.007752 seconds
[uploadconfig] Storing the configuration used in ConfigMap "kubeadm-config"
in the "kube-system" Namespace
[markmaster] Will mark node csle1 as master by adding a label and a taint
[markmaster] Master csle1 tainted and labelled with key/value:
node-role.kubernetes.io/master=""
[bootstraptoken] Using token: a96953.b5d1418a5099b5de
[bootstraptoken] Configured RBAC rules to allow Node Bootstrap tokens to
post CSRs in order for nodes to get long term certificate credentials
[bootstraptoken] Configured RBAC rules to allow the csrapprover controller
automatically approve CSRs from a Node Bootstrap Token
[bootstraptoken] Configured RBAC rules to allow certificate rotation for
all node client certificates in the cluster
[bootstraptoken] Creating the "cluster-info" ConfigMap in the "kube-public"
namespace
[addons] Applied essential addon: kube-dns
[addons] Applied essential addon: kube-proxy
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join --token a96953.b5d1418a5099b5de 129.254.xxx.xxx:6443
--discovery-token-ca-cert-hash sha256:648c1dd27c51edc0e90ff356f47599e1
a8bee800f77ada9f23fdacd8d69e62a0
</code></pre><p>다른 노드에서 master에 접속하기 위해서 아래의 부분을 저장해 둡니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">kubeadm <span class="token function">join</span> --token a96953.b5d1418a5099b5de 192.168.0.5:6443 \
--discovery-token-ca-cert-hash \
sha256:648c1dd27c51edc0e90ff356f47599e1a8bee800f77ada9f23fdacd8d69e62a0
</pre><h3 class="mume-header" id="master-csle1-k8s-master-%EB%85%B8%EB%93%9C-kubectl-%EC%8B%A4%ED%96%89%ED%99%98%EA%B2%BD-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[Master: csle1] K8s master 노드 kubectl 실행환경 설정하기</h3>
<p>먼저 사용자 계정을 csle로 변경합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">su</span> csle
csle@csle1:~$
</pre><pre data-role="codeBlock" data-info="" class="language-"><code>mkdir -p $HOME/.kube
yes | sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
export KUBECONFIG=$HOME/.kube/config
echo "export KUBECONFIG=$HOME/.kube/config" | tee -a ~/.bashrc
kubectl get componentstatus
</code></pre><h2 class="mume-header" id="kubernetes-node1-node2-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0-csle2-csle3">Kubernetes node1, node2 설정하기 (csle2, csle3)</h2>
<p>먼저 root 계정으로 변경합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">su</span> -
root@csle2:~$
</pre><h3 class="mume-header" id="csle2-csle3-kubernetes-master%EC%97%90-join-%ED%95%98%EA%B8%B0">[csle2, csle3] kubernetes master에 join 하기</h3>
<p>kublet을 재부팅합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">swapoff -a
systemctl daemon-reload
systemctl restart kubelet
systemctl status kubelet
</pre><p>kubernetes master에서 init시 생성된 script와 추가 옵션을 이용해 master에 join 합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">kubeadm <span class="token function">join</span> --token c8908d.5dc02f87aca87415 192.168.0.5:6443 \
--discovery-token-ca-cert-hash \
sha256:756ac632e63878260dc6b3a3497b8ba69d29087ba0428beaea061e4f5241b29d \
--ignore-preflight-errors<span class="token operator">=</span>all --discovery-token-unsafe-skip-ca-verification
</pre><h2 class="mume-header" id="kubernetes-master%EC%97%90%EC%84%9C-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0-csle1">kubernetes master에서 확인하기 (csle1)</h2>
<h3 class="mume-header" id="master-csle1-node-%EB%B0%8F-pod-%EB%8F%99%EC%9E%91-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0">[Master: csle1] node 및 pod 동작 확인하기</h3>
<p>node1, node2가 join이 성공했는지 아래의 명령을 이용해서 확인합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">root@csle1:~$ <span class="token function">sudo</span> <span class="token function">su</span> csle
csle@csle1:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
csle1 NotReady master 5m v1.9.6
csle2 NotReady <span class="token operator"><</span>none<span class="token operator">></span> 1m v1.9.6
csle3 NotReady <span class="token operator"><</span>none<span class="token operator">></span> 1m v1.9.6
</pre><h3 class="mume-header" id="master-csle1-kubernetes-%ED%81%B4%EB%9F%AC%EC%8A%A4%ED%84%B0-%ED%99%98%EA%B2%BD-%EA%B5%AC%EC%84%B1%EC%9D%84-%EC%9C%84%ED%95%9C-yaml-%ED%99%98%EA%B2%BD-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[Master: csle1] kubernetes 클러스터 환경 구성을 위한 yaml 환경 설정하기</h3>
<p>kubernetes master에서 클러스터 환경 구성을 위한 yaml 파일들을 이용해서 서비스를 생성합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">cd</span> /home/csle/ksb-csle/kubernetes/env_set
kubectl create -f kube-flannel.yml
kubectl create -f kubernetes-dashboard.yaml
kubectl create -f kubernetes-dashboard-admin-rbac.yaml
kubectl create -f ServiceAccount.yml
kubectl create -f ClusterRoleBinding.yml
kubectl create -f k8s-heapster/
</pre><pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
csle1 Ready master 5m v1.9.6
csle2 Ready <span class="token operator"><</span>none<span class="token operator">></span> 1m v1.9.6
csle3 Ready <span class="token operator"><</span>none<span class="token operator">></span> 1m v1.9.6
</pre><pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~$ kubectl get pods --all-namespaces
kube-system etcd-csle1 1/1 Running 2 1d
kube-system kube-apiserver-csle1 1/1 Running 2 1d
kube-system kube-controller-manager-csle1 1/1 Running 2 1d
kube-system kube-dns-6f4fd4bdf-vtqbt 3/3 Running 6 1d
kube-system kube-proxy-vwp26 1/1 Running 2 1d
kube-system kube-proxy-zs2sw 1/1 Running 2 1d
kube-system kube-scheduler-csle1 1/1 Running 2 1d
</pre><p>클러스터 환경 구성을 위한 pod가 정상적으로 구동되었는지 확인합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~/ksb-csle/kubernetes/env_set$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system etcd-csle1 1/1 Running 2 1d
kube-system heapster-dfd674df9-bz45s 1/1 Running 2 1d
kube-system kube-apiserver-csle1 1/1 Running 2 1d
kube-system kube-controller-manager-csle1 1/1 Running 2 1d
kube-system kube-dns-6f4fd4bdf-vtqbt 3/3 Running 6 1d
kube-system kube-flannel-ds-c6mpq 1/1 Running 2 1d
kube-system kube-flannel-ds-rc74q 1/1 Running 2 1d
kube-system kube-proxy-vwp26 1/1 Running 2 1d
kube-system kube-proxy-zs2sw 1/1 Running 2 1d
kube-system kube-scheduler-csle1 1/1 Running 2 1d
kube-system kubernetes-dashboard-5bd6f767c7-4qzj7 1/1 Running 2 1d
kube-system monitoring-grafana-76848b566c-4n4xj 1/1 Running 2 1d
kube-system monitoring-influxdb-6c4b84d695-ts7dk 1/1 Running 2 1d
</pre><h3 class="mume-header" id="master-csle1-ingress-%ED%99%98%EA%B2%BD-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[Master: csle1] Ingress 환경 설정하기</h3>
<p>kubernetes master에서 ingress를 설정합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">cd</span> /home/csle/ksb-csle/kubernetes/env_set
kubectl create -f default-backend-for-ingress.yaml
kubectl create -f configmap-nginx-ingress-controller.yaml
kubectl create -f deploy-nginx-ingress-controller.yaml
kubectl create -f ingress-rule.yaml
kubectl create -f svc-expose-by-nodeport.yaml
</pre><h3 class="mume-header" id="master-csle1-dashboard-url%EC%97%90-%EC%A0%91%EC%86%8D%ED%95%98%EA%B8%B0">[Master: csle1] Dashboard URL에 접속하기</h3>
<p>아래의 명령으로 dashboard 프록시를 동작시킵니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">kubectl create clusterrolebinding add-on-cluster-admin \
--clusterrole<span class="token operator">=</span>cluster-admin \
--serviceaccount<span class="token operator">=</span>kube-system:kubernetes-dashboard
kubectl proxy --port<span class="token operator">=</span>9999 --address<span class="token operator">=</span><span class="token string">'192.168.0.5'</span> --accept-hosts<span class="token operator">=</span><span class="token string">"^*$"</span>
</pre><p>크롬을 열어 아래의 주소로 쿠버네티스 dashboard에 접속한다.</p>
<p><a href="http://192.168.0.5:9999/ui">http://192.168.0.5:9999/ui</a></p>
<p>아래에서 skip을 선택하여 dashboard에 접속합니다.</p>
<p><img src="./images/1.6.KSB_K8s_install_Guide_01.png" alt="Dashboard 접속하기"></p>
<p><img src="./images/1.6.KSB_K8s_install_Guide_02.png" alt="Dashboard 접속화면"></p>
<h2 class="mume-header" id="ksb-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC%EC%99%80-%EC%97%B0%EB%8F%99%EC%9D%84-%EC%9C%84%ED%95%9C-%ED%99%98%EA%B2%BD%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">KSB 프레임워크와 연동을 위한 환경설정하기</h2>
<h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-ksb-%ED%88%B4%EB%B0%95%EC%8A%A4%EC%97%90-%ED%8F%AC%ED%95%A8%EB%90%9C-ssh-%EC%9D%B8%EC%A6%9D%ED%82%A4-%EA%B3%B5%EC%9C%A0%ED%95%98%EA%B8%B0">[모든 서버 공통] KSB 툴박스에 포함된 SSH 인증키 공유하기</h3>
<p>KSB 프레임워크의 엔진이 Kubernetes 마스터에 접속할때 인증 키를 묻지않도록 배포된 KSB 툴박스에 포함된 .ssh 폴더를 쿠버네티스 서버의 홈에 복사합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">cp</span> -r ~/ksb-csle/tools/.ssh/ /home/csle/
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-hadoop-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8%EC%9D%84-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] hadoop 프로그램을 설치하기</h3>
<p>~/ksb-csle/tools/hadoop-2.7.3 폴더를 master, node1, node2의 csle 홈 폴더에 복사합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">cp</span> -r ~/ksb-csle/tools/hadoop-2.7.3 /home/csle/
</pre><p>그리고 아래와 같이 설정합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">ln</span> -s hadoop-2.7.3 hadoop
</pre><h3 class="mume-header" id="%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-~bashrc-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] ~/.bashrc 수정하기</h3>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">sudo</span> <span class="token function">vi</span> ~/.bashrc
<span class="token function">export</span> JAVA_HOME<span class="token operator">=</span>/usr/lib/jvm/java-8-oracle
<span class="token function">export</span> PATH<span class="token operator">=</span><span class="token variable">$PATH</span><span class="token keyword">:</span><span class="token variable">$JAVA_HOME</span>/bin
<span class="token function">export</span> KSB_HOME<span class="token operator">=</span>/home/csle/ksb-csle
<span class="token function">export</span> PYTHONPATH<span class="token operator">=</span>/home/csle/ksb-csle/pyML/:<span class="token variable">$PYTHONPATH</span>
<span class="token function">export</span> PYTHONPATH<span class="token operator">=</span>./:/home/csle/ksb-csle/ksblib:<span class="token variable">$PYTHONPATH</span>
<span class="token function">export</span> KUBECONFIG<span class="token operator">=</span>/home/csle/.kube/config
<span class="token function">export</span> HADOOP_HOME<span class="token operator">=</span>/home/csle/hadoop-2.7.3
<span class="token function">export</span> HADOOP_PREFIX<span class="token operator">=</span><span class="token variable">$HADOOP_HOME</span>
<span class="token function">export</span> PATH<span class="token operator">=</span><span class="token variable">$PATH</span><span class="token keyword">:</span><span class="token variable">$HADOOP_PREFIX</span>/bin
<span class="token function">export</span> PATH<span class="token operator">=</span><span class="token variable">$PATH</span><span class="token keyword">:</span><span class="token variable">$HADOOP_PREFIX</span>/sbin
<span class="token function">export</span> HADOOP_CONF_DIR<span class="token operator">=</span><span class="token variable">$HADOOP_HOME</span>/etc/hadoop
<span class="token function">export</span> HADOOP_MAPRED_HOME<span class="token operator">=</span><span class="token variable">${HADOOP_PREFIX}</span>
<span class="token function">export</span> HADOOP_COMMON_HOME<span class="token operator">=</span><span class="token variable">${HADOOP_PREFIX}</span>
<span class="token function">export</span> HADOOP_HDFS_HOME<span class="token operator">=</span><span class="token variable">${HADOOP_PREFIX}</span>
<span class="token function">export</span> YARN_HOME<span class="token operator">=</span><span class="token variable">${HADOOP_PREFIX}</span>
<span class="token function">export</span> HADOOP_COMMON_LIB_NATIVE_DIR<span class="token operator">=</span><span class="token variable">${YARN_HOME}</span>/lib/native
<span class="token function">export</span> HADOOP_OPTS<span class="token operator">=</span><span class="token string">"-Djava.library.path=<span class="token variable">$YARN_HOME</span>/lib/native"</span>
<span class="token function">source</span> ~/.bashrc
</pre><p>이상으로 쿠버네티스와 KSB 툴박스와 연동을 하기 위한 모든 준비가 완료되었습니다.</p>
<h1 class="mume-header" id="faq">FAQ</h1>
<h3 class="mume-header" id="1-%EC%84%9C%EB%B2%84-%EC%9E%AC%EB%B6%80%ED%8C%85-%ED%9B%84-connection-%EC%97%90%EB%9F%AC%EA%B0%80-%EB%B0%9C%EC%83%9D%ED%95%98%EB%8A%94-%EA%B2%BD%EC%9A%B0">1. 서버 재부팅 후, connection 에러가 발생하는 경우</h3>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~$ kubectl get nodes
The connection to the server 192.168.0.5:6443 was refused
- did you specify the right host or port?
</pre><ul>
<li>해결 방법</li>
</ul>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~$ <span class="token function">sudo</span> -i
root@csle1:~<span class="token comment"># swapoff -a</span>
root@csle1:~<span class="token comment"># exit</span>
csle@csle1:~$ <span class="token function">strace</span> -eopenat kubectl version
</pre><h3 class="mume-header" id="2-%EC%84%9C%EB%B2%84-%EC%9E%AC%EB%B6%80%ED%8C%85-%ED%9B%84-dashboard%EA%B0%80-containercreating-%EC%83%81%ED%83%9C%EB%A1%9C-%EC%97%90%EB%9F%AC%EA%B0%80-%EB%B0%9C%EC%83%9D%ED%95%9C-%EA%B2%BD%EC%9A%B0">2. 서버 재부팅 후, dashboard가 ContainerCreating 상태로 에러가 발생한 경우</h3>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~/ksb-csle/kubernetes/env_set$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system etcd-csle1 1/1 Running 2 1d
kube-system heapster-dfd674df9-bz45s 1/1 Running 2 1d
kube-system kube-apiserver-csle1 1/1 Running 2 1d
kube-system kube-controller-manager-csle1 1/1 Running 2 1d
kube-system kube-dns-6f4fd4bdf-vtqbt 3/3 Running 6 1d
kube-system kube-flannel-ds-c6mpq 1/1 Running 2 1d
kube-system kube-flannel-ds-rc74q 1/1 Running 2 1d
kube-system kube-proxy-vwp26 1/1 Running 2 1d
kube-system kube-proxy-zs2sw 1/1 Running 2 1d
kube-system kube-scheduler-csle1 1/1 Running 2 1d
kube-system kubernetes-dashboard-5bd6f767c7-4qzj7 1/1 ContainerCreating 1d
kube-system monitoring-grafana-76848b566c-4n4xj 1/1 Running 2 1d
kube-system monitoring-influxdb-6c4b84d695-ts7dk 1/1 Running 2 1d
</pre><p>dashboard 관련 설정파일을 이용해서 pod를 delete 후, 재생성합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">cd</span> /home/csle/ksb-csle/kubernetes/env_set
kubectl delete -f kube-flannel.yml
kubectl delete -f kubernetes-dashboard.yaml
kubectl delete -f kubernetes-dashboard-admin-rbac.yaml
kubectl delete -f ServiceAccount.yml
kubectl delete -f ClusterRoleBinding.yml
kubectl delete -f k8s-heapster/
kubectl create -f kube-flannel.yml
kubectl create -f kubernetes-dashboard.yaml
kubectl create -f kubernetes-dashboard-admin-rbac.yaml
kubectl create -f ServiceAccount.yml
kubectl create -f ClusterRoleBinding.yml
kubectl create -f k8s-heapster/
</pre><h3 class="mume-header" id="3-ksb-%ED%88%B4%EB%B0%95%EC%8A%A4-docker-%EC%BB%A8%ED%85%8C%EC%9D%B4%EB%84%88%EC%97%90%EC%84%9C-host-pc%EC%97%90-ssh-%EC%A0%91%EC%86%8D%EC%8B%9C-password%EB%A5%BC-%EB%AC%BB%EB%8A%94%EC%A7%80-%ED%99%95%EC%9D%B8%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95">3. KSB 툴박스 docker 컨테이너에서 host pc에 ssh 접속시 password를 묻는지 확인하는 방법</h3>
<p>KSB 툴박스 docker 컨테이너에서 아래의 명령을 수행하여 각 kubernete 마스터와 노드에 접속시 password를 묻는지 확인합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle@csle1:~$ <span class="token function">ssh</span> -l csle csle1 -p 2243 <span class="token function">mkdir</span> -p \
/home/csle/ksb-csle/kubernetes/modelDB/kangnam/0001
Warning: Permanently added <span class="token string">'[csle1]:2243,[192.168.0.5]:2243'</span>
<span class="token punctuation">(</span>ECDSA<span class="token punctuation">)</span> to the list of known hosts.
csle@csle1:~$
csle@csle1:~$ <span class="token function">ssh</span> -l csle csle2 -p 2243 <span class="token function">mkdir</span> -p \
/home/csle/ksb-csle/kubernetes/modelDB/kangnam/0001
Warning: Permanently added <span class="token string">'[csle2]:2243,[192.168.0.6]:2243'</span>
<span class="token punctuation">(</span>ECDSA<span class="token punctuation">)</span> to the list of known hosts.
csle@csle1:~$
</pre><p>만약 password를 묻는다면, .ssh 폴더의 인증키가 공유되지 않은 상태입니다.<br>
password를 묻는 마스터 혹은 노드 HOST에서 대해서 아래의 절차대로 인증키를 복사하시기 바랍니다.</p>
<h4 class="mume-header" id="host-pc-ksb-%ED%88%B4%EB%B0%95%EC%8A%A4-docker-%EC%9D%B4%EB%AF%B8%EC%A7%80%EB%82%B4-ssh-%ED%82%A4%EB%A5%BC-host-pc%EC%97%90-%EB%B3%B5%EC%82%AC%ED%95%98%EA%B8%B0">[Host PC] KSB 툴박스 docker 이미지내 SSH 키를 host pc에 복사하기</h4>
<p>KSB 툴박스 docker 컨테이너의 인증키를 공유하기 위해 ksb-csle/tools 폴더에 있는 .ssh 폴더를 csle 홈에 카피합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">cp</span> -r ~/ksb-csle/tools/.ssh/ /home/csle/
<span class="token function">chmod</span> 600 ~/.ssh/authorized_keys
<span class="token function">chmod</span> 600 ~/.ssh/id_rsa
<span class="token function">chmod</span> 700 ~/.ssh/
<span class="token function">rm</span> ~/.ssh/known_hosts
<span class="token function">sudo</span> <span class="token function">service</span> <span class="token function">ssh</span> restart
</pre><h3 class="mume-header" id="4-%EC%BF%A0%EB%B2%84%EB%84%A4%ED%8B%B0%EC%8A%A4-%EC%84%A4%EC%B9%98-%ED%9B%84-ksb-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC-%EB%8F%99%EC%9E%91%EC%8B%9C-namenode%EA%B0%80-%EB%8F%99%EC%9E%91%ED%95%98%EC%A7%80-%EC%95%8A%EC%9D%84-%EA%B2%BD%EC%9A%B0">4. 쿠버네티스 설치 후, KSB 프레임워크 동작시 namenode가 동작하지 않을 경우</h3>
<p>거의 드물게 발생하는 에러로 jps 명령을 통해 KSB 툴박스에서 프로세스를 확인했을때 namenode가 검색되지 않는 경우가 있습니다.<br>
쿠버네티스의 etcd 가 사용하는 port와 hadoop이 사용하는 port 충돌로 인해 namenode가 초기화되지 않을 경우가 있습니다.<br>
확인하는 방법은 다음과 같습니다. 이러한 문제를 해결하는 방법은 kubernetes를 삭제하고 다시 설치하는 것이 가장 쉬운 방법입니다.<br>
위에서 설명한 삭제 및 설치를 다시 하고, 바로 10-kubeadm.conf 수정하기 부분을 수행하시고, kubeadm init을 하시면 쉽게 재설치가 됩니다.<br>
또한 node들에서도 kuberet 후, kubejoin으로 다시 클러스터를 설정하시면 됩니다.</p>
<h4 class="mume-header" id="host-pc-etcd-%EC%82%AC%EC%9A%A9-port-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0">[Host PC] etcd 사용 port 확인하기</h4>
<p>netstat -tnlpa | grep 2379</p>
<h4 class="mume-header" id="host-pc-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4-port%EC%82%AC%EC%9A%A9-%ED%99%95%EC%9D%B8">[Host PC] 프로세스 port사용 확인</h4>
<p>ps aux | grep 2379</p>
<h4 class="mume-header" id="host-pc-%EC%97%B4%EB%A0%A4%EC%9E%88%EB%8A%94-%ED%8C%8C%EC%9D%BC-%EB%AA%A9%EB%A1%9D-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0">[Host PC] 열려있는 파일 목록 확인하기</h4>
<p>sudo lsof -i TCP:2379</p>
<h4 class="mume-header" id="hadoop%EC%97%90%EC%84%9C-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-default-port-%EB%AA%A9%EB%A1%9D">hadoop에서 사용하는 default port 목록</h4>
<table>
<thead>
<tr>
<th>Daemon</th>
<th>Default Port</th>
<th>Configuration Parameter</th>
</tr>
</thead>
<tbody>
<tr>
<td>Namenode</td>
<td>50070</td>
<td>dfs.http.address</td>
</tr>
<tr>
<td>Datanodes</td>
<td>50075</td>
<td>dfs.datanode.http.address</td>
</tr>
<tr>
<td>Secondarynamenode</td>
<td>50090</td>
<td>dfs.secondary.http.address</td>
</tr>
<tr>
<td>Backup/Checkpoint node</td>
<td>50105</td>
<td>dfs.backup.http.address</td>
</tr>
<tr>
<td>Tasktrackers</td>
<td>50060</td>
<td>mapred.task.tracker.http.address</td>
</tr>
<tr>
<td>Jobracker</td>
<td>50030</td>
<td>mapred.job.tracker.http.address</td>
</tr>
</tbody>
</table>
<h3 class="mume-header" id="5-%EC%BF%A0%EB%B2%84%EB%84%A4%ED%8B%B0%EC%8A%A4-kubectl-%EB%AA%85%EB%A0%B9-alias-%EB%B0%A9%EB%B2%95">5. 쿠버네티스 kubectl 명령 alias 방법</h3>
<pre data-role="codeBlock" data-info="" class="language-"><code>echo "alias k=kubectl" >> ~/.bashrc
source <(kubectl completion bash | sed s/kubectl/k/g)
</code></pre>
</div>
<div class="md-sidebar-toc"><ul>
<li><a href="#kubernetes-%ED%81%B4%EB%9F%AC%EC%8A%A4%ED%84%B0-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">Kubernetes 클러스터 설치하기</a>
<ul>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84%EC%97%90-%EA%B3%B5%ED%86%B5%EC%9C%BC%EB%A1%9C-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">모든 서버에 공통으로 설치하기</a>
<ul>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-java-8-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] java 8 설치하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-%EA%B8%B0%ED%83%80-%EC%9A%B0%EB%B6%84%ED%88%AC-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] 기타 우분투 프로그램 설치하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-sshd-port-%EB%B3%80%EA%B2%BD-%EB%B0%8F-root-%EB%A1%9C%EA%B7%B8%EC%9D%B8-%EA%B0%80%EB%8A%A5%ED%95%98%EA%B2%8C-sshd-config-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] SSHD port 변경 및 root 로그인 가능하게 SSHD config 수정하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-ssh-config-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] SSH config 수정하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-ssh-%EC%84%9C%EB%B9%84%EC%8A%A4-%EC%9E%AC%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0">[모든 서버 공통] SSH 서비스 재시작하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-docker-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] docker 설치하기</a>
<ul>
<li><a href="#%EC%B0%B8%EA%B3%A0%EC%82%AC%ED%95%AD-%EA%B8%B0%EC%A1%B4-docker-engine-%EC%82%AD%EC%A0%9C">[참고사항] 기존 docker-engine 삭제</a></li>
</ul>
</li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-docker-sudo-%EB%AA%85%EB%A0%B9%EC%97%86%EC%9D%B4-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-%EC%9C%84%ED%95%9C-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] docker sudo 명령없이 사용하기 위한 설정하기</a></li>
</ul>
</li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-nvidia-docker-20-%EC%84%A4%EC%B9%98">[모든 서버 공통] nvidia-docker 2.0 설치</a><br>
* <a href="#%EC%B0%B8%EA%B3%A0%EC%82%AC%ED%95%AD-%EA%B8%B0%EC%A1%B4-10-%EB%B2%84%EC%A0%84%EC%9D%84-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0-%EC%9C%84%ED%95%B4%EC%84%9C%EB%8A%94-%EC%95%84%EB%9E%98%EC%9D%98-%EB%AA%85%EB%A0%B9%EC%9D%84-%EC%88%98%ED%96%89%ED%95%A9%EB%8B%88%EB%8B%A4">[참고사항] 기존 1.0 버전을 삭제하기 위해서는 아래의 명령을 수행합니다.</a>
<ul>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-kubernetes-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] Kubernetes 설치하기</a>
<ul>
<li><a href="#%EC%B0%B8%EA%B3%A0%EC%82%AC%ED%95%AD-%EA%B8%B0%EC%A1%B4-kubernetes-%EB%B2%84%EC%A0%84-%EC%82%AD%EC%A0%9C-%EB%B0%A9%EB%B2%95">[참고사항] 기존 Kubernetes 버전 삭제 방법</a></li>
</ul>
</li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-etcfstab-%EC%88%98%EC%A0%95-%ED%9B%84-%EC%9E%AC%EB%B6%80%ED%8C%85%ED%95%98%EA%B8%B0">[모든 서버 공통] /etc/fstab 수정 후 재부팅하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-kubernetes-master-etchosts-%EB%B3%80%EA%B2%BD%ED%95%98%EA%B8%B0">[모든 서버 공통] Kubernetes master /etc/hosts 변경하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-sysctl-kernel-parameter%EA%B0%92-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] sysctl kernel parameter값 수정하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-kubectl-%EB%AA%85%EB%A0%B9-%EC%98%B5%EC%85%98%EC%9D%98-%EC%9E%90%EB%8F%99-%EC%99%84%EC%84%B1-%EA%B8%B0%EB%8A%A5-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] kubectl 명령 옵션의 자동 완성 기능 설정하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-security-enhanced-linux-%EB%AA%A8%EB%93%9C-disable-%ED%95%98%EA%B8%B0">[모든 서버 공통] Security Enhanced Linux 모드 disable 하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-10-kubeadmconf-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] 10-kubeadm.conf 수정하기</a></li>
</ul>
</li>
<li><a href="#kubernetes-master-csle1-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">Kubernetes master (csle1) 설정하기</a>
<ul>
<li><a href="#master-csle1-kubeadm-%EC%B4%88%EA%B8%B0%ED%99%94%ED%95%98%EA%B8%B0">[Master: csle1] kubeadm 초기화하기</a></li>
<li><a href="#master-csle1-k8s-master-%EB%85%B8%EB%93%9C-kubectl-%EC%8B%A4%ED%96%89%ED%99%98%EA%B2%BD-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[Master: csle1] K8s master 노드 kubectl 실행환경 설정하기</a></li>
</ul>
</li>
<li><a href="#kubernetes-node1-node2-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0-csle2-csle3">Kubernetes node1, node2 설정하기 (csle2, csle3)</a>
<ul>
<li><a href="#csle2-csle3-kubernetes-master%EC%97%90-join-%ED%95%98%EA%B8%B0">[csle2, csle3] kubernetes master에 join 하기</a></li>
</ul>
</li>
<li><a href="#kubernetes-master%EC%97%90%EC%84%9C-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0-csle1">kubernetes master에서 확인하기 (csle1)</a>
<ul>
<li><a href="#master-csle1-node-%EB%B0%8F-pod-%EB%8F%99%EC%9E%91-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0">[Master: csle1] node 및 pod 동작 확인하기</a></li>
<li><a href="#master-csle1-kubernetes-%ED%81%B4%EB%9F%AC%EC%8A%A4%ED%84%B0-%ED%99%98%EA%B2%BD-%EA%B5%AC%EC%84%B1%EC%9D%84-%EC%9C%84%ED%95%9C-yaml-%ED%99%98%EA%B2%BD-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[Master: csle1] kubernetes 클러스터 환경 구성을 위한 yaml 환경 설정하기</a></li>
<li><a href="#master-csle1-ingress-%ED%99%98%EA%B2%BD-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">[Master: csle1] Ingress 환경 설정하기</a></li>
<li><a href="#master-csle1-dashboard-url%EC%97%90-%EC%A0%91%EC%86%8D%ED%95%98%EA%B8%B0">[Master: csle1] Dashboard URL에 접속하기</a></li>
</ul>
</li>
<li><a href="#ksb-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC%EC%99%80-%EC%97%B0%EB%8F%99%EC%9D%84-%EC%9C%84%ED%95%9C-%ED%99%98%EA%B2%BD%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">KSB 프레임워크와 연동을 위한 환경설정하기</a>
<ul>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-ksb-%ED%88%B4%EB%B0%95%EC%8A%A4%EC%97%90-%ED%8F%AC%ED%95%A8%EB%90%9C-ssh-%EC%9D%B8%EC%A6%9D%ED%82%A4-%EA%B3%B5%EC%9C%A0%ED%95%98%EA%B8%B0">[모든 서버 공통] KSB 툴박스에 포함된 SSH 인증키 공유하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-hadoop-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8%EC%9D%84-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">[모든 서버 공통] hadoop 프로그램을 설치하기</a></li>
<li><a href="#%EB%AA%A8%EB%93%A0-%EC%84%9C%EB%B2%84-%EA%B3%B5%ED%86%B5-~bashrc-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0">[모든 서버 공통] ~/.bashrc 수정하기</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#faq">FAQ</a><br>
* <a href="#1-%EC%84%9C%EB%B2%84-%EC%9E%AC%EB%B6%80%ED%8C%85-%ED%9B%84-connection-%EC%97%90%EB%9F%AC%EA%B0%80-%EB%B0%9C%EC%83%9D%ED%95%98%EB%8A%94-%EA%B2%BD%EC%9A%B0">1. 서버 재부팅 후, connection 에러가 발생하는 경우</a><br>
* <a href="#2-%EC%84%9C%EB%B2%84-%EC%9E%AC%EB%B6%80%ED%8C%85-%ED%9B%84-dashboard%EA%B0%80-containercreating-%EC%83%81%ED%83%9C%EB%A1%9C-%EC%97%90%EB%9F%AC%EA%B0%80-%EB%B0%9C%EC%83%9D%ED%95%9C-%EA%B2%BD%EC%9A%B0">2. 서버 재부팅 후, dashboard가 ContainerCreating 상태로 에러가 발생한 경우</a><br>
* <a href="#3-ksb-%ED%88%B4%EB%B0%95%EC%8A%A4-docker-%EC%BB%A8%ED%85%8C%EC%9D%B4%EB%84%88%EC%97%90%EC%84%9C-host-pc%EC%97%90-ssh-%EC%A0%91%EC%86%8D%EC%8B%9C-password%EB%A5%BC-%EB%AC%BB%EB%8A%94%EC%A7%80-%ED%99%95%EC%9D%B8%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95">3. KSB 툴박스 docker 컨테이너에서 host pc에 ssh 접속시 password를 묻는지 확인하는 방법</a><br>
* <a href="#host-pc-ksb-%ED%88%B4%EB%B0%95%EC%8A%A4-docker-%EC%9D%B4%EB%AF%B8%EC%A7%80%EB%82%B4-ssh-%ED%82%A4%EB%A5%BC-host-pc%EC%97%90-%EB%B3%B5%EC%82%AC%ED%95%98%EA%B8%B0">[Host PC] KSB 툴박스 docker 이미지내 SSH 키를 host pc에 복사하기</a><br>
* <a href="#4-%EC%BF%A0%EB%B2%84%EB%84%A4%ED%8B%B0%EC%8A%A4-%EC%84%A4%EC%B9%98-%ED%9B%84-ksb-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC-%EB%8F%99%EC%9E%91%EC%8B%9C-namenode%EA%B0%80-%EB%8F%99%EC%9E%91%ED%95%98%EC%A7%80-%EC%95%8A%EC%9D%84-%EA%B2%BD%EC%9A%B0">4. 쿠버네티스 설치 후, KSB 프레임워크 동작시 namenode가 동작하지 않을 경우</a><br>
* <a href="#host-pc-etcd-%EC%82%AC%EC%9A%A9-port-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0">[Host PC] etcd 사용 port 확인하기</a><br>
* <a href="#host-pc-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4-port%EC%82%AC%EC%9A%A9-%ED%99%95%EC%9D%B8">[Host PC] 프로세스 port사용 확인</a><br>
* <a href="#host-pc-%EC%97%B4%EB%A0%A4%EC%9E%88%EB%8A%94-%ED%8C%8C%EC%9D%BC-%EB%AA%A9%EB%A1%9D-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0">[Host PC] 열려있는 파일 목록 확인하기</a><br>
* <a href="#hadoop%EC%97%90%EC%84%9C-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-default-port-%EB%AA%A9%EB%A1%9D">hadoop에서 사용하는 default port 목록</a><br>
* <a href="#5-%EC%BF%A0%EB%B2%84%EB%84%A4%ED%8B%B0%EC%8A%A4-kubectl-%EB%AA%85%EB%A0%B9-alias-%EB%B0%A9%EB%B2%95">5. 쿠버네티스 kubectl 명령 alias 방법</a></li>
</ul>
</div>
<a id="sidebar-toc-btn">≡</a>
</body>
<script>
document.body.setAttribute('html-show-sidebar-toc', true)
var sidebarTOCBtn = document.getElementById('sidebar-toc-btn')
sidebarTOCBtn.addEventListener('click', function(event) {
event.stopPropagation()
if (document.body.hasAttribute('html-show-sidebar-toc')) {
document.body.removeAttribute('html-show-sidebar-toc')
} else {
document.body.setAttribute('html-show-sidebar-toc', true)
}
})
</script>
</html>