Kubernetes on Cloud Private Hands-on Guide (Single Node)

ย 

  • IBM Cloud private ์„ค์น˜ ๊ฐ€์ด๋“œ

๋ณธ๋ฌธ์—์„œ๋Š” IBM Cloud private CE(Community Edition)์„ ์„ค์น˜ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. IBM Cloud private๊ณผ ๊ด€๋ จ๋œ ๋‚ด์šฉ์€ โ€˜Kubernetes On Cloud Privateโ€™ ํฌ์ŠคํŒ…์„ ์ฐธ์กฐํ•ด ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

 

  • IBM Cloud private ์„ค์น˜์‹œ ํ•„์š” ํ•˜๋“œ์›จ์–ด ์ŠคํŒฉ

  • ์‹ฑ๊ธ€๋…ธ๋“œ๋กœ IBM Cloud private ๊ตฌ์„ฑํ•˜๊ธฐ

IBM Cloud private์˜ ์•„ํ‚คํ…์ณ๋ฅผ ํ™•์ธํ•˜์‹œ๊ฒŒ ๋˜๋ฉด ๊ธฐ๋ณธ์ ์œผ๋กœ 3๊ฐœ์˜ ๋…ธ๋“œ(Master Node(Boot Node์™€ ๊ฐ™์ด ์‚ฌ์šฉ ๊ฐ€๋Šฅ), Proxy Node, Worker Node)๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ Production ํ™˜๊ฒฝ์—์„œ ์šด์˜ํ•  ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ํ…Œ์ŠคํŠธ ์šฉ๋„๋กœ ๊ฐ„๋‹จํžˆ ๊ตฌ์„ฑํ•ด๋ณด๊ธฐ์—๋Š” ๋‹จ์ผ ๋…ธ๋“œ (VM 1EA)๋กœ๋„ ๊ตฌ์„ฑํ•ด๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜์˜ ์ ˆ์ฐจ๋ฅผ ๋”ฐ๋ผํ•ด ์ฃผ์„ธ์š”.

 

  • Bluemix Infra VM ์ƒ์„ฑ

๋ณธ๋ฌธ์—์„œ๋Š” IBM Cloud private ์„ ์„ค์น˜ํ•˜๊ธฐ ์œ„ํ•ด Bluemix Infra(๊ตฌ. Softlayer) ์ž์›์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
๊ฐ€์ƒ ์„œ๋ฒ„ ์ƒ์„ฑ์„ ์œ„ํ•ด์„œ๋Š” ๋””๋ฒจ๋กœํผ ์›์Šค์˜ โ€˜IBM Cloud ๊ฐ€์ƒ์„œ๋ฒ„ ์ƒ์„ฑ ๋ฐ ๊ด€๋ฆฌํ•˜๊ธฐโ€™ (URL: https://ibm.biz/BdiN6Y )ํฌ์ŠคํŒ…์„ ์ฐธ์กฐํ•ด ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

 

Step1. IBM Bluemix Infrastructure ์‚ฌ์šฉ์ž ํฌํƒˆ์„ ํ†ตํ•ด ์•„๋ž˜ ์ •๋ณด๋ฅผ ๊ฐ€์ง„ ๊ฐ€์ƒ๋จธ์‹ ์„ ์ƒ์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.
๊ธˆ๋ฒˆ ํ•ธ์ฆˆ์˜จ์—์„œ๋Š” ์šฐ๋ถ„ํˆฌ 16.04 LTS ๋ฒ„์ „์œผ๋กœ ์‹ค์Šตํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

  • Datacenter: Seoul(SEO01)
  • Hostname: pcsingle
  • Public IP: 169.56.126.22
  • Private IP: 10.178.9.155
  • OS: Ubuntu Linux 16.04 LTS Xenial Xerus Minimal Install (64 bit)
  • CPU: 1 x 2.0 GHz Core
  • RAM: 2GB
  • Disk(Local): 25GB
  • Network Port Speed: 100 Mbps Public & Private Network Uplinks

 

Step2. ๊ฐ€์ƒ๋จธ์‹ ์— ์ ‘์†ํ•ด ์„ค์น˜๋œ ํŒจํ‚ค์ง€๋ฅผ ์—…๋ฐ์ดํŠธ ํ•ฉ๋‹ˆ๋‹ค.

root@pcsingle:~# apt-get update

Get:1 http://mirrors.service.networklayer.com/ubuntu xenial InRelease [247 kB]

Get:2 http://mirrors.service.networklayer.com/ubuntu xenial-updates InRelease [102 kB] โ€ฆโ€ฆ

 

Step3. ๋งˆ์Šคํ„ฐ ๋…ธ๋“œ์—์„œ๋Š” ์ตœ์†Œํ•œ์˜ vm.max_map_count ๊ฐ’์ด 262144๋ฅผ ๋ณด์žฅํ•ด์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์•„๋ž˜์™€ ๊ฐ™์€ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

root@pcsingle:~# sudo sysctl -w vm.max_map_count=262144

vm.max_map_count = 262144

 

Step4. ํŒŒ์ด์ฌ๊ณผ ๋„์ปค๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ ๋„์ปค ์„ค์น˜๊ฐ€ ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ์ด์ฌ ์„ค์น˜

root@pcsingle:~# sudo apt install python

๋„์ปค ์„ค์น˜ ๋ฐ ์‹คํ–‰

root@pcsingle:~# curl -s https://get.docker.com/ | sudo sh

root@pcsingle:~# sudo systemctl start docker

 

Step5. ์‹ฑ๊ธ€๋…ธ๋“œ๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด ๋‹ค์ˆ˜์˜ ๋…ธ๋“œ๋ฅผ ์ ‘์†ํ•˜๊ธฐ ์œ„ํ•ด ๊ฐ ๋…ธ๋“œ ์ ‘์† ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ด์ฃผ๊ฑฐ๋‚˜ SSH๋ฅผ ์„ค์ •ํ•ด ์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์‹ฑ๊ธ€ ๋…ธ๋“œ์—์„œ๋Š” ์ถ”๊ฐ€ ์„ค์ • ์—†์ด IBM Cloud private ๋ฅผ ์„ค์น˜ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด IBM Cloud ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ์„ค์น˜ ์ด๋ฏธ์ง€๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

root@pcsingle:~# sudo docker pull ibmcom/cfc-installer:1.2.0

1.2.0: Pulling from ibmcom/cfc-installer

d54efb8db41d: Pull complete

f8b845f45a87: Pull complete

e8db7bf7c39f: Pull complete

9654c40e9079: Pull complete

6d9ef359eaaa: Pull complete

a881bbac5349: Pull complete

a9094d0a1d95: Pull complete

1509e7f394f5: Pull complete

87ab7e3b41f8: Pull complete

Digest: sha256:623e01f8f645cad358121acb033106a4a3f23e408f97c942da9a15ec8684c409

Status: Downloaded newer image for ibmcom/cfc-installer:1.2.0

root@pcsingle:~# sudo systemctl start docker

 

Step6. ๊ฐ€์ ธ์˜จ ์ด๋ฏธ์ง€๋ฅผ ์‹คํ–‰ํ•ด IBM Cloud private์„ VM์— ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•œ ํด๋”์— IBM Cloud private์ด ์„ค์น˜๋˜๋ฏ€๋กœ ๊ฒฝ๋กœ ์„ค์ •์— ์œ ์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

root@pcsingle:~# sudo docker run -e LICENSE=accept –rm \

> -v “$(pwd)”:/data ibmcom/cfc-installer:1.2.0 cp -r cluster

 

Step7. ์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด cluster ํด๋”๊ฐ€ ์ƒ์„ฑ๋˜๊ณ  ๊ทธ ํ•˜์œ„์— ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๋™์ž‘์„ ์œ„ํ•œ config.yaml ํŒŒ์ผ, ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์œ„ํ•œ ๋…ธ๋“œ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•˜๋Š” hosts ํŒŒ์ผ, ldap๊ณผ ๊ฐ™์€ ์ธ์ฆ์„ ์œ„ํ•œ misc ํด๋”, ์—ฌ๋Ÿฌ ๋…ธ๋“œ๊ฐ„ ํ†ต์‹ ์„ ์œ„ํ•ด Private SSH key๋ฅผ ์ €์žฅํ•ด ๋†“์„ ssh_key ํŒŒ์ผ(์‹ฑ๊ธ€ ๋…ธ๋“œ์—์„œ๋Š” ssh_key ํŒŒ์ผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ)์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

 

Step8. Hosts ํŒŒ์ผ์„ ์—ด์–ด master node, worker node, proxy node์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ์‹ฑ๊ธ€ ๋…ธ๋“œ์—์„œ๋Š” ๊ฐ ๋…ธ๋“œ์˜ ์—ญํ• ์„ ํ•˜๋‚˜์˜ VM์—์„œ ์ง„ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ธˆ๋ฒˆ์— ์ƒ์„ฑํ•œ VM ์ •๋ณด๋งŒ์œผ๋กœ hosts ํŒŒ์ผ์„ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์ดˆ๊ธฐ์— ํ™•์ธํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ default ๊ฐ’์œผ๋กœ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋…ธ๋“œ์˜ HA ๊ตฌ์„ฑ์„ ์œ„ํ•ด master ๋…ธ๋“œ์™€ proxy ๋…ธ๋“œ์— ๋ณต์ˆ˜๊ฐœ์˜ ip๊ฐ€ ์„ค์ • ๋  ์ˆ˜ ์žˆ์œผ๋ฉฐ ๋ฆฌ์†Œ์Šค ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•ด ๋‹ค์ˆ˜์˜ worker ๋…ธ๋“œ๊ฐ€ ์ถ”๊ฐ€ ๊ตฌ์„ฑ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

root@pcsingle:~/cluster# vi hosts

 

[master]

1.1.1.1

 

[worker]

2.2.2.2

2.2.2.9

 

[proxy]

3.3.3.3

 

Step9. ์„œ๋ฒ„ ์ƒ์„ฑ์‹œ ํ™•์ธํ–ˆ๋˜ VM์˜ Public ip์ •๋ณด๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

[master]

169.56.126.22

 

[worker]

169.56.126.22

 

[proxy]

169.56.126.22

 

Step10. SSH๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ถ”๊ฐ€์ ์œผ๋กœ config.yaml ํŒŒ์ผ์„ ์ˆ˜์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ํŒŒ์ผ์— ๋…ธ๋“œ์˜ ํŒจ์Šค์›Œ๋“œ๋ฅผ ์ž…๋ ฅํ•จ์œผ๋กœ์จ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค๊ฐ€ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. ์‹ฑ๊ธ€ ๋…ธ๋“œ์—์„œ๋Š” ๋™์ผํ•œ ํ•˜๋‚˜์˜ VM๋งŒ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ชจ๋“  ๋…ธ๋“œ๊ฐ€ ๊ฐ™์€ ํŒจ์Šค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋Š” ๊ฐ€์ •ํ•˜์— ์•„๋ž˜์™€ ๊ฐ™์ด ๋‚ด์šฉ์„ ๋งˆ์ง€๋ง‰์ค„์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

ansible_user: root

ansible_ssh_pass: Nkhyd5Cm //๊ฐ์ž์˜ VM ํŒจ์Šค์›Œ๋“œ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

ansible_ssh_common_args: “-oPubkeyAuthentication=no”

  • ๋ณด์•ˆ์ ์ธ ์ธก๋ฉด์—์„œ yaml ํŒŒ์ผ์— ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋“ฑ๋กํ•ด ๋†“๋Š” ๊ฒƒ์€ ๋ณด์•ˆ ์‚ฌ๊ณ ๋ฅผ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. SSH๋ฅผ ํ†ตํ•œ ๋…ธ๋“œ๊ฐ„ ํ†ต์‹ ์„ ๊ถŒ์žฅ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

 

Step11. ์ˆ˜์ •๋œ ๋…ธ๋“œ ์ •๋ณด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์‹คํ–‰์ด ์™„๋ฃŒ๋˜๋ฉด CLI ํ•˜๋‹จ์— IBM Cloud private ๊ด€๋ฆฌ ์ฝ˜์†” ์ ‘์† ์ •๋ณด๊ฐ€ ๋‚˜ํƒ€๋‚˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์„ค์น˜ํ•œ cluster ํด๋” ๋‚ด์—์„œ ์‹คํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

root@pcsingle:~/cluster# docker run -e LICENSE=accept –net=host –rm -t -v “$(pwd)”:/installer/cluster ibmcom/cfc-installer:1.2.0 install

 

์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๊ตฌ์„ฑ ๋ฐ ์ธ์ฆ์„ ์œ„ํ•œ ํŒŒ์ผ๋“ค์ด ์ถ”๊ฐ€์ ์œผ๋กœ ์„ค์น˜๋ฉ๋‹ˆ๋‹ค.

Step12. ๊ด€๋ฆฌ ์ฝ˜์†”์˜ Default ์ ‘์† ID์™€ PW๋Š” admin/ admin ์ž…๋‹ˆ๋‹ค.
์„ค์น˜๊ฐ€ ์™„๋ฃŒ ๋œ ํ›„ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด Certi ๋ฅผ ์—…๋ฐ์ดํŠธ ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ์กด์˜ ๋ฒ„์ „์—์„œ ์—…๋ฐ์ดํŠธ ๋˜์—ˆ์œผ๋ฏ€๋กœ, ๋ฏธ ์—…๋ฐ์ดํŠธ ์‹œ ์ฝ˜์†” ์ ‘์†์ด ์•ˆ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

root@pcmaster:~/cluster#wget https://www.ibm.com/developerworks/community/files/form/anonymous/api/library/08eb2105-21e6-479b-8c5d-76a39e55c16a/document/3c1c3da4-ac5b-4c86-a495-2f6cba166734/media/update-cert.sh && bash update-cert.sh

 

 

Step13. IBM Cloud private ์‚ญ์ œํ•˜๊ธฐ

root@pcsingle:~/cluster# docker run -e LICENSE=accept –net=host –rm –name=installer -t -v $(pwd):/installer/cluster ibmcom/cfc-installer:1.2.0 uninstall

 

  • ์ฐธ๊ณ  URL

๊ฐœ์š”: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W1559b1be149d_43b0_881e_9783f38faaff

์•„ํ‚คํ…์ณ: https://www.ibm.com/support/knowledgecenter/SSBS6K_1.2.0/getting_started/architecture.html?view=kc#concept_d1n_rxq_pw

์Šฌ๋ž™ ์ดˆ๋Œ€: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W1559b1be149d_43b0_881e_9783f38faaff/page/Slack%20channel%20%28IBM%20Cloud%20technology%29%20sign%20up%20page

 

[์„ค์น˜]

ํ•„์š” ํ•˜๋“œ์›จ์–ด ์‚ฌ์–‘: https://www.ibm.com/support/knowledgecenter/SSBS6K_1.2.0/supported_system_config/system_reqs.html

์‚ฌ์ „ ํ•„์š” ์„ค์น˜: https://www.ibm.com/support/knowledgecenter/SSBS6K_1.2.0/installing/prep_cluster.html

SSH key ๊ณต์œ  ๋ฐ ssh_key ํด๋”์— ๋ณต์‚ฌ: https://www.ibm.com/support/knowledgecenter/SSBS6K_1.2.0/installing/ssh_keys.html

Docker ์„ค์น˜: https://subicura.com/2017/01/19/docker-guide-for-beginners-2.html

IBM Cloud private ce ์„ค์น˜ ๋ฐ ์‹คํ–‰: https://www.ibm.com/support/knowledgecenter/SSBS6K_1.2.0/installing/install_containers_CE.html

์‹คํ–‰: https://www.ibm.com/support/knowledgecenter/SSBS6K_1.2.0/installing/install_containers_CE.html

ย 

[ํŠœํ† ๋ฆฌ์–ผ]

https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W1559b1be149d_43b0_881e_9783f38faaff/page/Tutorials

ย 

[kubectl cli ๋‹ค์šด๋กœ๋“œ]

https://kubernetes.io/docs/tasks/tools/install-kubectl/

ย 

[git client ์„ค์น˜:์šฐ๋ถ„ํˆฌ]

https://git-scm.com/book/ko/v1/%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0-Git-%EC%84%A4%EC%B9%98

ํ† ๋ก  ์ฐธ๊ฐ€

์ด๋ฉ”์ผ์€ ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ์ž…๋ ฅ์ฐฝ์€ * ๋กœ ํ‘œ์‹œ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค