brunch

EKS 2탄-6. AWS EKS- 부하테스트-6/11

실습 2탄 = 6/11

by Master Seo

<1> 부하 테스트

<2> 수집된 측정 항목 보기

<3> 수집된 로그 보기 , 조회하기

<4> Cloudwatch 알람 받기




<1> 부하 테스트


1

watch -d kubectl get ns,deploy,rs,svc,pods



2

# 부하 받는 서버 생성 , NGINX 생성 하자. Heml관리툴로 설치하자.


[root@demo2 ~]# kubens

amazon-cloudwatch

default

kube-node-lease

kube-public

kube-system


[root@demo2 ~]# kubens default



https://brunch.co.kr/@topasvga/1694




3

WP 사이트 부하 테스트 ?


mywebserver-nginx


export elb=$(kubectl -n default get svc mywebserver-nginx -o jsonpath="{.status.loadBalancer.ingress[].hostname}")


echo $elb



4


# ab 설치

yum install apr-util -y

yum install httpd-tools -y


ab -n 100000 -c 100 $elb/


ab -n 10000 -c 100 http://a3854ae848383c4a261917.ap-northeast-2.elb.amazonaws.com/




# 참고 , 부하 테스트 툴 설치


https://brunch.co.kr/@topasvga/4189






<2> 수집된 측정 항목 보기


확인?

1

# 터미널3

yum install -y htop


htop



2

콘솔


cloudwatch


https://docs.aws.amazon.com/ko_kr/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html



<3> 수집된 로그 보기 , 조회하기


cloudwatch > logs insights










<4> Cloudwatch 알람 받기


참고

https://docs.aws.amazon.com/ko_kr/AmazonCloudWatch/latest/monitoring/Best-Practice-Alarms.html


1

Cloudwatch > Alarms > Create Alarm > Select metric


300 view 메트릭.png



2

metric 클릭


320 알람.png



3

알람설정 cpu 1% 이상 설정

330 1이상.png



340 new topic.png


create new topic 클릭 > (topasvga@naver.com 에 가서 확인 눌러줘야 한다.)

seo-eks-pod-cpu-1-over-name

// 위 이름으로 메일 온다.

> create alarm



4

다시 부하 테스트 하자




5

메일로 가서 Cloudwatch Alarm 이 왔는지 확인

350 알람 수신.png





# 기타 - WP 정리


1

kubectl get ns


NAME STATUS AGE

amazon-cloudwatch Active 82m

default Active 45h

kube-node-lease Active 45h

kube-public Active 45h

kube-system Active 45h

wordpress-cwi Active 173m



kubens


kubens wordpress-cwi




2

helm -n wordpress-cwi uninstall understood-zebu


kubectl delete namespace wordpress-cwi

(5분 소요)



3

Container Insights를 삭제 ?


curl -s https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/quickstart/cwagent-fluentd-quickstart.yaml | sed "s/{{cluster_name}}/eksworkshop-eksctl/;s/{{region_name}}/${AWS_REGION}/" | kubectl delete -f -



4

SNS 삭제, 구독 삭제?


# Delete the SNS Topic

aws sns delete-topic --topic-arn arn:aws:sns:${AWS_REGION}:${ACCOUNT_ID}:wordpress-CPU-Alert



# Delete the subscription

aws sns unsubscribe --subscription-arn $(aws sns list-subscriptions | jq -r '.Subscriptions[].SubscriptionArn')



5

정책 제거?


aws iam detach-role-policy --policy-arn arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy --role-name ${ROLE_NAME}





# AWS EKS 실습 2탄


https://brunch.co.kr/@topasvga/1882


https://brunch.co.kr/@topasvga/1679



다음과정

https://brunch.co.kr/@topasvga/1698


keyword
매거진의 이전글EKS 2탄-5. AWS EKS-클라우드와치-5/11