도커(Docker)와 쿠버네티스(Kubernetes)를 활용한 컨테이너(Container)관리_정리5(kubernetes)
LoadBalancer
쿠버네티스는 자체에서 LB를 지원하지 않음.
클라우드 벤더를 따로 사용해야함.
MetalLB :: MetalLB, bare metal load-balancer for Kubernetes
MetalLB is a load-balancer implementation for bare metal Kubernetes clusters, using standard routing protocols. Note Despite the beta status of the project / API, MetalLB is known to be stable and reliable. The project maturity page explains what that impl
metallb.io
MetalLB (베어메탈 로드벨런스) 설치하기
configmaps : 보여주는 것
secret : 안보여주는 것
https://metallb.io/installation/#preparation
쿠버네티스 1.14.2 버전 부터는 strict ARP mode를 True로 해주어야 한다
kubectl edit configmaps kube-proxy -n kube-system
Installation :: MetalLB, bare metal load-balancer for Kubernetes
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 compatibility page
metallb.io
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.9/config/manifests/metallb-native.yaml
kubectl apply -f ipaddressPool.yaml
kubectl apply -f deploy.yaml
kubectl apply -f nginx-service.yaml
라벨 : selector 맞춰줄 것
로드벨런서 포트는 클러스터 포트를 사용 (8001)
라운드 로빈(RR) 로 vm (노드) 접속 하는 역할
kubectl exec -it test -c second -- /bin/sh
k8s 특정 컨테이너 접속 명령어
한개의 파드에 여러개 컨테이너가 있는 것을 멀티 컨테이너라고 함
k9s
편리하게 모니터링 및 관리할 수 있는 유틸리티
curl -sSLo k9s_Linux_amd64.tar.gz https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_amd64.tar.gz
tar -xzf k9s_Linux_amd64.tar.gz
./k9s
storage
kubectl delete all --all --force
모든 리소스(deploy, rs, svc 등) 강제 삭제 (secret 제외)
hostpath
로컬 /var/tmp/web_docs 에서 컨테이너 /usr/share/nginx/html 로 마운트
worker1 로컬 볼륨에 마운트 된 것을 확인
하지만 worker2 에 index 파일이 없음
nodeName 추가 (잘 쓰지 않음)
emptyDir
apply 후
파드를 삭제 하면 데이터도 날라감
PV, PVC
PV(persistence Volume), PVC(Persistence Volume Claim)
각 apply 후