2021.07. ์ด์ฅ์ฌ ๐ง [email protected] ๐ https://github.com/jangjaelee ๐ http://www.awx.kr
MetalLB๋ Load Balancer๊ฐ ์๋ Bare-metal K8S cluster๋ฅผ ์ํด ํ์ค ๋ผ์ฐํ ํ๋กํ ์ฝ์ ์ฌ์ฉํ์ฌ ์ํํธ์จ์ด์ ์ผ๋ก Network Load Balancer๋ฅผ ๊ธฐ๋ฅ์ ๊ตฌํ ํด์ฃผ๋ ์๋ฃจ์ ์ ๋๋ค.
๊ทธ๋ ๋ค๋ฉด ์ MetalLB๋ฅผ ์ฌ์ฉ ํ ๊น์?
Kubernetes์ Pod๋ ์ํฉ์ ๋ฐ๋ผ ์๋ฉธ๊ณผ ์ฌ์์ฑ์ ๋ฐ์กฑํ๊ฒ ๋๋๋ฐ ์ด ๋๋ง๋ค Pod์ ํ ๋น๋๋ IP์ฃผ์๊ฐ ๋ณ๊ฒฝ๋์ด Endpoint๋ก ์ด๋ ต๊ฒ ๋ฉ๋๋ค. ๋ํ ๋ค์์ Pod์์ ๊ฐ์ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ด์ฉํ ๊ฒฝ์ฐ ํธ๋ํฝ์ Pod์ ํ๋ ค ๋ณด๋ผ LoadBalancer๊ฐ ํ์ํ๊ฒ ๋๋ฉฐ ๋จ์ผ Endpoint๋ฅผ ์ธ๋ถ๋ก ๋ ธ์ถ ์ํค๊ธฐ ์ํด Kubernetes์ Service ์ค๋ธ์ ํธ์์ LoadBalancer Type์ ํตํด ํ์ฉ ํ ์ ์๊ฒ ๋ฉ๋๋ค.
LoadBalancer Type์ ์ฌ์ฉํ๋ฉด ์ธ๋ถ์์ ์ ๊ทผ ๊ฐ๋ฅํ External-IP๋ฅผ ํ ๋น ๋ฐ์์ผ ํ๋๋ฐ LoadBalancer๋ฅผ ํตํด External-IP๋ฅผ ํ ๋น ๋ฐ๊ธฐ ์ํด์๋ Managed Kubernets Service๋ฅผ ์ ๊ณตํ๋ Cloud Service Provier(CSP - AWS, GCP, Azure ๋ฑ)์ Load Balancer(AWS - Elastic Load Balancer, Azure - Azure Load Balancer, GCP - Cloud Load Balancing)์์ ์ ๊ณต ๋ฐ์ ์ ์์ง๋ง, Bare-metal ํ๊ฒฝ์ Kubernetes๋ LoadBalancer๋ฅผ ์ ๊ณต ํ์ง ์์ External-IP์ pending ์ผ๋ก ์ฐํ๋ฉฐ IP๋ฅผ ํ ๋น ๋ฐ์ง ๋ชป ํ๊ฒ ๋ฉ๋๋ค.
cluster ์์ผ๋ก client traffic์ ๊ฐ์ ธ์ค๊ธฐ ์ํด Service type์ "NodePort"์ "externalIPs"์ผ๋ก ์ฌ์ฉ ํ ์ ์์ง๋ง ์ด ๋ ์ต์ ์ ๋ชจ๋ Production ํ๊ฒฝ์์๋ ๋จ์ ๋ค์ด ๋ง์ต๋๋ค.
client traffic์ Bare-metal Kubernetes cluster ๋ด๋ก ๊ฐ์ ธ์ค๊ธฐ ์ํด์๋ Load Balancer ๊ตฌํ ํด์ค ์ ์๋ Hardware Appliance Ingress Controller๋ฅผ ์ฌ์ฉํ๋ฉด ๋์ง๋ง ์๋นํ ๊ณ ๊ฐ์ ์ฅ๋น ์ ๋๋ค.
MetalLB๋ Software๋ก Load Balancer ๊ธฐ๋ฅ์ ๊ตฌํํ์ฌ Bare-metal Kubernetes cluster์์ Network Load Balancer ์์ด Load Balancing ๊ธฐ๋ฅ์ ์ ๊ณต ํ๋ ์คํ์์ค ์๋ฃจ์ ์ ๋๋ค.
์ ๋ ์ฌ์ฉ ๊ฒฝํ์ ์์ง๋ง On-Premise ํ๊ฒฝ์ Kubernetes์์ Load Balancer๋ฅผ Hardware๋ก ์ฌ์ฉ ํ ์ ์๋๋ก Ingress Controller๋ฅผ ์ ๊ณตํ๋ Hardware Appliance๊ฐ ์์ด ์๋ ๋งํฌ๋ฅผ ๋จ๊ธฐ๋ ์ฐธ๊ณ ํด๋ณด์๊ธฐ ๋ฐ๋๋๋ค.