본문 바로가기

컴퓨터/클라우드 (Cloud)

Ubuntu, Kubernetes Metallb 설치 정리

2개의 ubuntu system으로 구성된 kubernetes cluster의 master node에 설치

 

1. Enable strict ARP mode

 

kubectl get configmap kube-proxy -n kube-system -o yaml | \
sed -e "s/strictARP: false/strictARP: true/" | \
kubectl apply -f - -n kube-system

 

2. Install metallab by Manifest

 

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml

 

3. namespace 확인

 

kubectl get namespaces

 

output:

 

 

4. pod 확인

 

kubectl get pods -n metallb-system

 

output:

 

 

5. base-metallb.yaml 파일 작성

 

# addresses 에 사용할 ip대역 입력
# name 확인

apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: base-pool
  namespace: metallb-system
spec:
  addresses:
  - 192.168.0.150-192.168.0.200

---

apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: base-l2-nework
  namespace: metallb-system
spec:
  ipAddressPools:
  - base-pool

 

6. 작성된 yaml 파일 적용

 

kubectl apply -n metallb-system -f base-metallb.yaml

 

7. 테스트

nginx deployment 테스트

 

kubectl create deploy nginx --image nginx:latest

 

7-1. deployment 확인

 

kubectl get all

 

output:

 

 

7-2. LoadBalancer (metallb) 연결

 

kubectl expose deploy nginx --port 80 --type LoadBalancer

 

7-3. deployment 확인

 

kubectl get all

 

output:

 

 

7-4. serivce 확인

 

kubectl get svc

 

output:

 

 

7-5. nginx deployment, service 종료

 

kubectl delete deployment nginx

kubectl delete service nginx

 

참고글

 

https://metallb.universe.tf/installation/

 

MetalLB, bare metal load-balancer for Kubernetes

Installation Before starting with installation, make sure you meet all the requirements. In particular, you should pay attention to network addon compatibility. If you’re trying to run MetalLB on a cloud platform, you should also look at the cloud compat

metallb.universe.tf

 

https://metallb.universe.tf/configuration/

 

MetalLB, bare metal load-balancer for Kubernetes

Configuration MetalLB remains idle until configured. This is accomplished by creating and deploying various resources into the same namespace (metallb-system) MetalLB is deployed into. There are various examples of the configuration CRs in configsamples. A

metallb.universe.tf

 

https://www.youtube.com/watch?v=Yl8JKffmhuE

 

https://andrewpage.tistory.com/23

 

MetalLB 설치 (2022년 12월 20일에 설치)

MetalLB v0.13.x 설치 (2022년 12월 20일) MetalLB의 버전에 따라 설치 결과가 조금씩 달라서 MetalLB를 설치한 날짜를 밝힌다. 아래 절차를 따라하면 MetalLB 설치, 그리고 예제 앱 테스트 모두 잘 동작한다. Me

andrewpage.tistory.com