서비스 파드 배포 테스트 nlb # 모니터링 watch -d kubectl get pod,svc,ep # 작업용 EC2 - 디플로이먼트 & 서비스 생성 curl -s -O https://raw.githubusercontent.com/gasida/PKOS/main/2/echo-service-nlb.yaml cat echo-service-nlb.yaml | yh kubectl apply -f echo-service-nlb.yaml # 확인 kubectl get deploy,pod kubectl get svc,ep,ingressclassparams,targetgroupbindings kubectl get targetgroupbindings -o json | jq # AWS ELB(NLB) 정보 확인 aws elbv2 describe-load-balancers | jq aws elbv2 describe-load-balancers --query 'LoadBalancers[*].State.Code' --output text # 웹 접속 주소 확인 kubectl get svc svc-nlb-ip-type -o jsonpath={.status.loadBalancer.ingress[0].hostname} | awk '{ print "Pod Web URL = http://"$1 }' # 파드 로깅 모니터링 kubectl logs -l app=deploy-websrv -f # 분산 접속 확인 NLB=$(kubectl get svc svc-nlb-ip-type -o jsonpath={.status.loadBalancer.ingress[0].hostname}) curl -s $NLB for i in {1..100}; do curl -s $NLB | grep Hostname ; done | sort | uniq -c | sort -nr 52 Hostname: deploy-echo-55456fc798-2w65p 48 Hostname: deploy-echo-55456fc798-cxl7z # 지속적인 접속 시도 : 아래 상세 동작 확인 시 유용(패킷 덤프 등) while true; do curl -s --connect-timeout 1 $NLB | egrep 'Hostname|client_address'; echo "----------" ; date "+%Y-%m-%d %H:%M:%S" ; sleep 1; done