실습 2탄 = 5/11
<1> EKS 클러스터 서버에 cloudwatch 에이전트 설치.
<1> EKS 클러스터 서버에 cloudwatch 에이전트 설치.
cwagent-fluentd 설치
1
EKS 클러스터 서버에 cloudwatch 에이전트 설치한다.
역할 확인
test -n "$ROLE_NAME" && echo ROLE_NAME is "$ROLE_NAME" || echo ROLE_NAME is not set
ROLE_NAME is eksctl-eksworkshop-eksctl-nodegro-NodeInstanceRole-11G0xxx
2
role에 정책 연결?
aws iam attach-role-policy --role-name $ROLE_NAME --policy-arn arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy
3
정책 연결 확인?
aws iam list-attached-role-policies --role-name $ROLE_NAME | grep CloudWatchAgentServerPolicy || echo 'Policy not found'
"PolicyName": "CloudWatchAgentServerPolicy",
"PolicyArn": "arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"
4
cloudwatch insight 설치?
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 apply -f -
namespace/amazon-cloudwatch created
serviceaccount/cloudwatch-agent created
clusterrole.rbac.authorization.k8s.io/cloudwatch-agent-role created
clusterrolebinding.rbac.authorization.k8s.io/cloudwatch-agent-role-binding created
configmap/cwagentconfig created
daemonset.apps/cloudwatch-agent created
configmap/cluster-info created
serviceaccount/fluentd created
clusterrole.rbac.authorization.k8s.io/fluentd-role created
clusterrolebinding.rbac.authorization.k8s.io/fluentd-role-binding created
configmap/fluentd-config created
daemonset.apps/fluentd-cloudwatch created
5
데몬셋 배포 확인?
kubectl -n amazon-cloudwatch get daemonsets
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
cloudwatch-agent 3 3 3 3 3 <none> 34s
fluentd-cloudwatch 3 3 3 3 3 <none> 34s
6
콘솔 접속
Cloudwatch > Container Insights > Resources > EKS Cluster
7
AWS 워크셥으로 공부하기~
Container Insights work shop
https://www.eksworkshop.com/intermediate/250_cloudwatch_container_insights/
https://brunch.co.kr/@topasvga/1697
https://brunch.co.kr/@topasvga/1882
https://brunch.co.kr/@topasvga/1679
감사합니다.