kubernetes

์žฅ์—ฌ์ง„ยท2022๋…„ 5์›” 8์ผ
0
post-thumbnail

kubernetes๋ž€?๐Ÿค”

  • ์ปจํ…Œ์ด๋„ˆ ์šด์˜์„ ์ž๋™ํ™”ํ•˜๊ธฐ ์œ„ํ•œ ๋„๊ตฌ๋กœ ๋„์ปค ๊ด€๋ฆฌ์ž!!
  • ํด๋Ÿฌ์ŠคํŠธ > ๋…ธ๋“œ > ํŒŒ๋“œ > ์ปจํ…Œ์ด๋„ˆ๋กœ ๊ตฌ์„ฑ
  • ๋„์ปค์Šค์›œ(docker-swarm)์—ญํ•  - ์ปจํ…Œ์ด๋„ˆ ์˜ค์ผ€์ŠคํŠธ๋ ˆ์ด์…˜ = ์ปจํ…Œ์ด๋„ˆ ๊ด€๋ฆฌ์ž(์ฃฝ์€์•  ์‚ด๋ ค์ฃผ๊ธฐ ๋“ฑ)
  • ๋„์ปค์Šค์›œ = ๋ฉ”์†Œ์Šค = ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค(๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉ) ๋ชจ๋‘ ๋น„์Šทํ•œ ์—ญํ• 

๐Ÿ’กkubernetes๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ 

  • ์ปดํ“จํ„ฐ 1๋Œ€๋กœ๋Š” ์„œ๋น„์Šค๋ฅผ ์šด์˜ํ•˜๋Š” ๊ฒƒ์€ ๋งŽ์€ ์–ด๋ ค์›€์ด ์žˆ์Œ
  • ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์—ฌ๋Ÿฌ ํด๋ผ์šฐ๋“œ ์„œ๋น„์Šค๋“ค ์ค‘ ํ•˜๋‚˜๊ฐ€ kubernetes!
  • kubernetes๋Š” ๋กค๋ง๋ฐฐํฌ(ํ•œ๋ฒˆ์— ์š”์ฒญ์„ ๋ณด๋‚ด๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ๋‚˜๋ˆ ์„œ ๋ณด๋‚ด๋Š” ๋ฐฉ๋ฒ•), ์ž๋™ํ™•์žฅ(ํŒŒ๋“œ๊ฐ€ ํ•„์š”ํ• ๋•Œ๋งˆ๋‹ค ํŒŒ๋“œ๋ฅด ์ž๋™์œผ๋กœ ํ™•์žฅ)๊ธฐ๋Šฅ์„ ๊ฐ€์ง€๊ณ  ์žˆ์Œ!๐Ÿ‘๐Ÿป

    โญ๏ธโญ๏ธ ํŠธ๋ž˜ํ”ฝ์ด ์ฆ๊ฐ€๋˜๋ฉด kubernetes๊ฐ€ ๋…ธ๋“œ ์ฆ๊ฐ€ -> pod ์ฆ๊ฐ€
    nestjs๋ฅผ Deployment ํ•˜๋ฉด์„œ pod ๊ฐ€ ์žฌ์‹œ์ž‘
    ์žฌ์‹œ์ž‘ํ•˜๋ฉด์„œ ํŒŒ๋“œ๊ฐ€ ๋ชจ๋‘ ํ•œ๋ฒˆ์— ์ค‘๋‹จ๋˜๊ณ  ์‹œ์ž‘๋˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ๋‚˜๋ˆ„์–ด์„œ ์ง„ํ–‰ - ๋กค๋ง ๋ฐฐํฌ(25%)๋กœ ์‹คํ–‰

๐Ÿ’กํด๋Ÿฌ์ŠคํŠธ> ๋…ธ๋“œ > ํŒŒ๋“œ > ์ปจํ…Œ์ด๋„ˆ

1) ํด๋Ÿฌ์ŠคํŠธ(Cluster)

  • ์ปดํ“จํ„ฐ๋“ค์˜ ์ง‘ํ•ฉ์ฒด(= ๋…ธ๋“œ์˜ ์ง‘ํ•ฉ์ฒด)

2) ๋…ธ๋“œ(Node)

  • ํŒŒ๋“œ๊ฐ€ ๋“ค์–ด์žˆ๋Š” ๊ณณ(ํด๋Ÿฌ์Šคํ„ฐ ๋งŒ๋“ค๋ฉด ์ž๋™์ƒ์„ฑ)
  • master node vs worker node

3) ํŒŒ๋“œ(Pod)

  • ํŒŒ๋“œ์•ˆ์—์„œ ๋„์ปค ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰
  • ๋ณดํ†ต ํ•˜๋‚˜์˜ ํŒŒ๋“œ์— ํ•˜๋‚˜์˜ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ด์šฉ (์—ฌ๋Ÿฌ๊ฐœ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•˜๊ธด ํ•จ)

๐Ÿ“Œkubernetes ๊ด€๋ จ ๋ช…๋ น์–ด
kubectl get pods
Kubuctl get deployment
Kubectl rollout restart deployment/[deployment์ด๋ฆ„]
Kuectl get pods -o yaml => yaml ํŒŒ์ผ ๋ณผ ์ˆ˜ ์žˆ์Œ
Kubectl set image deployment/[ ๊ธฐ์กด pod name] containerId [์žฌ๋ฐฐํฌํ•  image]

0๊ฐœ์˜ ๋Œ“๊ธ€