1
[root@ip-10-2-1-128 ~]# more 5.sh
ALB=My-ALB-407199315.us-east-2.elb.amazonaws.com
for i in {1..20}; do curl $ALB -s -q ; done | sort | uniq -c | sort -nr
[root@ip-10-2-1-128 ~]# chmod 700 5.sh
[root@ip-10-2-1-128 ~]# ./5.sh
2
# 분산 접속 확인
NLB=$(kubectl get svc svc-nlb-ip-type -o jsonpath={.status.loadBalancer.ingress[0].hostname})
echo $NLB
k8s-default-svcnlbip-d959415c0b-fb49155dc99f1dc2.elb.ap-northeast-2.amazonaws.com
curl -s $NLB
for i in {1..100}; do curl -s $NLB | grep Hostname ; done | sort | uniq -c | sort -nr
3
# 지속적인 접속 시도 : 아래 상세 동작 확인 시 유용(패킷 덤프 등)
while true; do curl -s --connect-timeout 1 $NLB | egrep 'Hostname|client_address'; echo "----------" ; date "+%Y-%m-%d %H:%M:%S" ; sleep 1; done
1
while true; do dig www.masterseo0.link ;sleep 3;done
2
while true; do aws ec2 describe-instances --query "Reservations[*].Instances[*].{PublicIPAdd:PublicIpAddress,PrivateIPAdd:PrivateIpAddress,InstanceName:Tags[?Key=='Name']|[0].Value,Status:State.Name}" --filters Name=instance-state-name,Values=running --output text ; echo "------------------------------" ; sleep 1; done
------------------------------
myeks-myeks-nodegroup-Node 192.168.2.48 54.180.105.93 running
myeks-host 192.168.1.100 15.165.76.115 running
myeks-myeks-nodegroup-Node 192.168.1.186 15.165.17.199 running
3
while true; do ip -br -c addr show && echo "--------------" ; date "+%Y-%m-%d %H:%M:%S" ; sleep 1; done
N1=$(kubectl get node --label-columns=topology.kubernetes.io/zone --selector=topology.kubernetes.io/zone=ap-northeast-2a -o jsonpath={.items[0].status.addresses[0].address})
N2=$(kubectl get node --label-columns=topology.kubernetes.io/zone --selector=topology.kubernetes.io/zone=ap-northeast-2b -o jsonpath={.items[0].status.addresses[0].address})
N3=$(kubectl get node --label-columns=topology.kubernetes.io/zone --selector=topology.kubernetes.io/zone=ap-northeast-2c -o jsonpath={.items[0].status.addresses[0].address})
echo "export N1=$N1" >> /etc/profile
echo "export N2=$N2" >> /etc/profile
echo "export N3=$N3" >> /etc/profile
echo $N1, $N2, $N3
https://brunch.co.kr/@topasvga/3558
https://brunch.co.kr/@topasvga/3581
감사합니다.