brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Jul 09. 2021

EKS 2탄-6. AWS EKS- 부하테스트와 모니터링

실습 2탄 = 6/11

<1> 부하 테스트

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

<3> 수집된 로그 보기

<4>  Cloudwatch 알람 받기

<5>  WP 정리?



<1> 부하 테스트


1

부하 테스트 툴 설치

sudo yum install siege -y



2

siege --version

SIEGE 3.0.8



3

WP 사이트  부하 테스트 ?


export WP_ELB=$(kubectl -n wordpress-cwi get svc understood-zebu-wordpress -o jsonpath="{.status.loadBalancer.ingress[].hostname}")


siege -q -t 15S -c 200 -i http://${WP_ELB}


15초 동안 다양한 URL 에서  200개 동시 연결

15초후 결과 나옴




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


확인?

EKS Services >   커스텀 >   30분 주기 확인

Performance monitoring






<3> 수집된 로그 보기


log 보기?

Container insights > Resources >  EKS Service 클릭

맨 아래  Pod 클릭

오른쪽 Action > View application log












<4>  Cloudwatch 알람 받기


1

Cloudwatch  >  Container Insights > Resources >  EKS Service 선택

오른쪽 위  점 3개  클릭



2

View in metric 클릭

종 모양 클릭하여 알람 설정



3

알람설정   cpu 1% 이상 설정




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

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

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

>  create alarm



4

다시 부하 테스트 하자

siege -q -t 15S -c 200 -i http://${WP_ELB}



5

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





<5>  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



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}




다음과정


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





<10>   AWS EKS 실습 2탄


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


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


감사합니다.


        

매거진의 이전글 EKS 2탄-5. AWS EKS- 에이전트  설치

작품 선택

키워드 선택 0 / 3 0

댓글여부

afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari