Cluster

Cluster๋ž€?

  • Kubernetes๋ฅผ ๋ฐฐํฌํ•˜๋ฉด Cluster๋ฅผ ์–ป๋Š”๋‹ค

  • Kubernetes Cluster๋Š” ์ปจํ…Œ์ด๋„ˆํ™”๋œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‹คํ–‰ํ•˜๋Š” node ๋ผ๊ณ  ํ•˜๋Š” worker machine๋“ค์˜ ์ง‘ํ•ฉ์ด๋‹ค

  • ๋ชจ๋“  cluster๋Š” ์ตœ์†Œ ํ•˜๋‚˜ ์ด์ƒ์˜ worker node ๋ฅผ ๊ฐ€์ง„๋‹ค

Cluster Architecture

ํ•˜๋“œ์›จ์–ด ์ˆ˜์ค€์—์„œ Kubernetes Cluster๋Š” ์—ฌ๋Ÿฌ node๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ, ๋‘ ๊ฐ€์ง€ ์œ ํ˜•์œผ๋กœ ๋‚˜๋ˆŒ ์ˆ˜ ์žˆ๋‹ค

  1. ๋งˆ์Šคํ„ฐ ๋…ธ๋“œ

    ์ „์ฒด Kubernetes system์„ ์ œ์–ดํ•˜๊ณ , ๊ด€๋ฆฌํ•˜๋Š” Kubernetes Control Plane ์„ ์‹คํ–‰ํ•œ๋‹ค

  2. ์›Œ์ปค ๋…ธ๋“œ

    ์‹ค์ œ ๋ฐฐํฌ๋˜๋Š” container application์„ ์‹คํ–‰ํ•œ๋‹ค

Control Plane

Control Plane์€ Cluster๋ฅผ ์ œ์–ดํ•˜๊ณ  ์ž‘๋™์‹œํ‚จ๋‹ค

ํ•˜๋‚˜์˜ master node์—์„œ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜ ์—ฌ๋Ÿฌ node๋กœ ๋ถ„ํ• ๋˜๊ณ  ๋ณต์ œ๋˜์–ด ๊ณ ๊ฐ€์šฉ์„ฑ์„ ๋ณด์žฅํ•  ์ˆ˜ ์žˆ๋Š” ์•„๋ž˜ ์š”์†Œ๋“ค๋กœ ๊ตฌ์„ฑ๋œ๋‹ค

Kubernetes API Server

API Server๋Š” Kubernetes API๋ฅผ ๋…ธ์ถœํ•˜๋Š” component์ด๋‹ค

์‚ฌ์šฉ์ž, Control Plane ๊ตฌ์„ฑ ์š”์†Œ์™€ ํ†ต์‹ ํ•œ๋‹ค

kube-apiserver

  • kube-apiserver๋Š” ์ˆ˜ํ‰์œผ๋กœ ํ™•์žฅ ๋˜๋„๋ก ๋””์ž์ธ๋˜์—ˆ๋‹ค

    • ์ฆ‰, ๋” ๋งŽ์€ ์ธ์Šคํ„ด์Šค๋ฅผ ๋ฐฐํฌํ•ด์„œ ํ™•์žฅํ•  ์ˆ˜ ์žˆ๋‹ค

  • ์—ฌ๋Ÿฌ kube-apiserver ์ธ์Šคํ„ด์Šค๋ฅผ ์‹คํ–‰ํ•˜๊ณ , ์ธ์Šคํ„ด์Šค๊ฐ„์˜ traffic์„ ๊ท ํ˜•์žˆ๊ฒŒ ์กฐ์ ˆํ•  ์ˆ˜ ์žˆ๋‹ค

Scheduler

Node๊ฐ€ ๋ฐฐ์ •๋˜์ง€ ์•Š์€ ์ƒˆ๋กœ ์ƒ์„ฑ๋œ Pod๋ฅผ ๊ฐ์ง€ํ•˜๊ณ , ์‹คํ–‰ํ•  node๋ฅผ ์„ ํƒํ•˜๋Š” component

  • Application์˜ ๋ฐฐํฌ๋ฅผ ๋‹ด๋‹นํ•œ๋‹ค

    • Application์˜ ๋ฐฐํฌ ๊ฐ€๋Šฅํ•œ ๊ฐ ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ worker node์— ํ• ๋‹นํ•œ๋‹ค

  • Scheduling ์„ ์œ„ํ•ด ๊ณ ๋ ค๋˜๋Š” ์š”์†Œ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค

    • ๊ฐœ๋ณ„/์ด์ฒด์  Resource requirements

    • Hardware/Software Policy ์ œ์•ฝ

    • Affinity & anti-affinity ๋ช…์„ธ

    • Data ์ง€์—ญ์„ฑ

    • Workload ๊ฐ„ ๊ฐ„์„ญ

    • Deadline

Controller Manager

Controller process๋ฅผ ์‹คํ–‰ํ•˜๋Š” component

  • ๊ตฌ์„ฑ ์š”์†Œ์˜ ๋ณต์ œ๋ณธ, worker node ์ถ”์ , node ์žฅ์•  ์ฒ˜๋ฆฌ ๋“ฑ๊ณผ ๊ฐ™์€ cluster ๋‹จ์˜ ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ํ•œ๋‹ค

  • ๋…ผ๋ฆฌ์ ์œผ๋กœ ๊ฐ controller๋Š” ๋ถ„๋ฆฌ๋œ process ์ง€๋งŒ, ๋ณตํ•ฉ์„ฑ์„ ๋‚ฎ์ถ”๊ธฐ ์œ„ํ•ด ํ•˜๋‚˜์˜ binary๋กœ compile๋˜๊ณ , ๋‹จ์ผ process ๋‚ด์—์„œ ์‹คํ–‰๋œ๋‹ค

Controller Types

  • Node controller

    • Node๊ฐ€ ๋‹ค์šด๋˜์—ˆ์„ ๋•Œ ์•Œ๋ฆฌ๊ณ , ์‘๋‹ตํ•˜๋Š” ๊ฒƒ์— ๋Œ€ํ•œ ์ฑ…์ž„์„ ์ง„๋‹ค

  • Job controller

    • ์ผํšŒ์„ฑ Job object๋ฅผ ์ถ”์ ํ•˜๊ณ , ํ•ด๋‹น ์ž‘์—…์ด ์‹คํ–‰๋  ์ˆ˜ ์žˆ๊ฒŒ Pod๋ฅผ ์ƒ์„ฑํ•œ๋‹ค

  • Endpoints controller

    • Service์™€ Pod๋ฅผ ์—ฐ๊ฒฐ์‹œํ‚จ๋‹ค

  • Service Account & Token controllers

    • ์ƒˆ๋กœ์šด Namespace์— ๋Œ€ํ•œ default account์™€ API access token์„ ์ƒ์„ฑํ•œ๋‹ค

etcd

Cluster ๊ตฌ์„ฑ์„ ์ง€์†์ ์œผ๋กœ ์ €์žฅํ•˜๋Š” ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋Š” key-value ๊ตฌ์กฐ์˜ ๋ถ„์‚ฐ ๋ฐ์ดํ„ฐ ์ €์žฅ์†Œ ์ด๋‹ค

๐Ÿ’ก Control Plane์˜ ๊ตฌ์„ฑ ์š”์†Œ๋Š” Cluster ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•˜๊ณ  ์ œ์–ดํ•˜์ง€๋งŒ, application์„ ์‹คํ–‰ํ•˜์ง„ ์•Š๋Š”๋‹ค โ†’ ์ด๊ฒƒ์€ Node์—์„œ ์ด๋ฃจ์–ด์ง„๋‹ค

Node

Worker Node๋Š” containerํ™”๋œ application์„ ์‹คํ–‰ํ•˜๋Š” ์‹œ์Šคํ…œ์ด๋‹ค

Application์„ ์‹คํ–‰ํ•˜๊ณ  ๋ชจ๋‹ˆํ„ฐ๋งํ•˜๋ฉฐ, application์— ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•˜๋Š” ์ž‘์—…์€ ์•„๋ž˜์˜ ๊ตฌ์„ฑ์š”์†Œ์— ์˜ํ•ด ์ˆ˜ํ–‰๋œ๋‹ค

Container Runtime

Container ์‹คํ–‰์„ ๋‹ด๋‹นํ•œ๋‹ค

Container๋ฅผ ์‹คํ–‰ํ•˜๋Š” Docker, containerd , CRI-O ๋˜๋Š” Kubernetes CRI (์ปจํ…Œ์ด๋„ˆ ๋Ÿฐํƒ€์ž„ ์ธํ„ฐํŽ˜์ด์Šค) ๊ตฌํ˜„ํ•œ ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ์ง€์›ํ•œ๋‹ค

Kubelet

API Server์™€ ํ†ต์‹ ํ•˜๊ณ  node์˜ container๋ฅผ ๊ด€๋ฆฌํ•œ๋‹ค

  • Cluster์˜ ๊ฐ node์—์„œ ์‹คํ–‰๋˜๋Š” agent์ด๋ฉฐ, Pod์—์„œ container๊ฐ€ ๋™์ž‘ํ•˜๋„๋ก ๊ด€๋ฆฌํ•œ๋‹ค

  • ๋‹ค์–‘ํ•œ ๋งค์ปค๋‹ˆ์ฆ˜์„ ํ†ตํ•ด PodSpec ์˜ ์ง‘ํ•ฉ์„ ๋ฐ›์•„์„œ container๊ฐ€ ํ•ด๋‹น Pod ์ŠคํŽ™์— ๋”ฐ๋ผ ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜๋Š”์ง€ ๊ด€๋ฆฌํ•œ๋‹ค

  • Kubernetes๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋˜์ง€ ์•Š์€ container๋Š” ๊ด€๋ฆฌํ•˜์ง€ ์•Š๋Š”๋‹ค

Kube-proxy

Application ๊ตฌ์„ฑ ์š”์†Œ ๊ฐ„์— ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ์„ ๋กœ๋“œ๋ฐธ๋Ÿฐ์‹ฑ ํ•˜๋Š” Kube-Proxy

  • Cluster์˜ ๊ฐ node์—์„œ ์‹คํ–‰๋˜๋Š” ๋„คํŠธ์›Œํฌ ํ”„๋ก์‹œ ๋กœ, Kubernetes service ๊ฐœ๋…์˜ ๊ตฌํ˜„๋ถ€์ด๋‹ค

  • Node์˜ ๋„คํŠธ์›Œํฌ ๊ทœ์น™์„ ์œ ์ง€/๊ด€๋ฆฌํ•œ๋‹ค

    • ๋„คํŠธ์›Œํฌ ๊ทœ์น™์ด ๋‚ด๋ถ€ ๋„คํŠธ์›Œํฌ session ์ด๋‚˜ cluster ๋ฐ–์—์„œ pod๋กœ ๋„คํŠธ์›Œํฌ ํ†ต์‹ ์„ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค€๋‹ค

Last updated