- 태스크 9: Amazon CloudWatch Container Insights 배포2024년 05월 08일
- 59lee
- 작성자
- 2024.05.08.:43
이 글은 스킬빌더 내용 바탕으로 제가 출력한 값을 넣은 글입니다. 오해 없길 바랍니다.
Amazon CloudWatch Container Insights는 컨테이너화된 애플리케이션과 마이크로서비스에서 지표와 로그를 수집하고 집계하며 요약합니다. CloudWatch Container Insights는 Amazon Elastic Container Service(Amazon ECS), Amazon Elastic Kubernetes Service(Amazon EKS) 및 Amazon EC2의 Kubernetes 플랫폼에서 사용할 수 있습니다.
이 태스크에서는 CloudWatch Container Insights를 실습 애플리케이션에 추가하고 그 결과를 검토합니다. 첫 번째 단계는 필수 IAM 정책인 CloudWatchAgentServerPolicy를 Amazon EKS 컴퓨팅 노드 연결 역할 정책에 추가하는 것입니다.
- 명령: Amazon EKS 인스턴스 역할에 IAM 정책을 추가하려면 다음 명령을 실행합니다.
export instanceId=$(aws ec2 describe-instances \\ --filters Name=instance-type,Values=t3.medium \\ --query "Reservations[0].Instances[*].InstanceId" \\ --output text) export instanceProfileArn=$(aws ec2 describe-instances \\ --instance-ids $instanceId \\ --query 'Reservations[*].Instances[*].IamInstanceProfile.Arn' \\ --output text) export instanceProfileName=$(echo $instanceProfileArn | \\ awk -F/ '{print $NF}') export roleName=$(aws iam get-instance-profile \\ --instance-profile-name $instanceProfileName \\ --query "InstanceProfile.Roles[*].RoleName" \\ --output text) sudo chmod +x ~/environment/eksLabRepo/containerInsights.sh ~/environment/eksLabRepo/./containerInsights.sh
사전 조건에 관한 자세한 내용은 Container Insights - 사전 조건 확인을 참조하십시오.
- 명령: CloudWatch Container Insights를 Amazon EKS 클러스터에 배포하려면 다음 명령을 실행합니다.
export CLUSTER_NAME=$(aws eks describe-cluster \\ --name eks-lab-cluster \\ --query 'cluster.name' \\ --output text) curl <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}}/$CLUSTER_NAME/;s/{{region_name}}/$AWS_DEFAULT_REGION/" | \\ kubectl apply -f -
예상 출력:
****************************** **** This is OUTPUT ONLY. **** ****************************** % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16515 100 16515 0 0 86834 0 --:--:-- --:--:-- --:--:-- 86921 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
CloudWatch Container Insights는 클러스터 데이터를 완전히 배포하고 표시하는 데 8~10분이 소요될 수 있습니다. 다음 단계를 진행하기 전에 배포가 완료될 때까지 기다리십시오.
- CloudWatch 서비스에 액세스하려면 AWS Management Console의 Services 메뉴에서 Management & Governance를 선택한 다음, CloudWatch를 선택합니다.
- 탐색 창에서 Insights를 선택한 후 Container Insights를 선택합니다.
IAM 권한 오류가 발견되면 경고를 무시하고 다음 단계를 계속 진행할 수 있습니다.
- Kubernetes 환경의 지도를 보려면 오른쪽 상단 영역에서 Map view를 선택합니다.
- Select a cluster 필드에 커서를 놓고 드롭다운 메뉴에서 eks-lab-cluster를 선택합니다.
- Select a node 필드에 커서를 놓고 드롭다운 메뉴에서 containers-lab 네임스페이스를 선택합니다. containers-lab 네임스페이스의 리소스를 표시하도록 맵이 업데이트되고 화면 하단의 지표 패널에는 CPU 사용률, 메모리 사용률 및 네트워크 통계가 표시됩니다.
PU, 메모리 및 네트워크 사용률을 보여주는 지표 페이지를 확인하십시오.
이 실습에서는 대시보드를 볼 때 표시되는 IAM 권한 오류를 무시해도 됩니다.
Amazon EKS의 CloudWatch Container Insights에 대해 자세히 알아보려면 Amazon EKS 및 Kubernetes의 Container Insights에 대한 Quick Start 설정을 참조하십시오.
결론
축하합니다! 이제 다음 태스크를 수행할 수 있어야 합니다.
- AWS Cloud9 작업 공간을 준비합니다.
- Amazon EKS 클러스터를 생성합니다.
- Docker 애플리케이션을 준비하여 Amazon ECR 리포지토리로 푸시합니다.
- AWS Load Balancer Controller를 배포합니다.
- Amazon EKS 클러스터에 애플리케이션을 배포합니다.
- Kubernetes 클러스터에서 CloudWatch Container Insights를 구성하고 확인합니다.
실습 종료
다음 단계에 따라 콘솔을 닫고 실습을 종료합니다.
- AWS Management Console로 돌아갑니다.
- 페이지 오른쪽 상단에서 AWSLabsUser를 선택하고 Sign out을 선택합니다.
- 실습 종료를 선택한 다음 실습을 종료할 것임을 확인합니다.
추가 리소스
- AWS 워크숍 - Kubernetes 소개
- Amazon EKS 클러스터 생성
- Amazon EKS용 kubeconfig 생성
- Kubernetes kubectl 치트 시트
AWS Training and Certification에 대한 자세한 내용은 *https://aws.amazon.com/training/*을 참조하십시오.
여러분의 피드백을 환영합니다. 피드백, 제안 사항 또는 수정 요청 사항을 제공하려면 *AWS Training and Certification 문의 양식*에 세부 정보를 입력해 주시기 바랍니다.
태스크 9: Amazon CloudWatch Container Insights 배포
Amazon CloudWatch Container Insights는 컨테이너화된 애플리케이션과 마이크로서비스에서 지표와 로그를 수집하고 집계하며 요약합니다. CloudWatch Container Insights는 Amazon Elastic Container Service(Amazon ECS), Amazon Elastic Kubernetes Service(Amazon EKS) 및 Amazon EC2의 Kubernetes 플랫폼에서 사용할 수 있습니다.
이 태스크에서는 CloudWatch Container Insights를 실습 애플리케이션에 추가하고 그 결과를 검토합니다. 첫 번째 단계는 필수 IAM 정책인 CloudWatchAgentServerPolicy를 Amazon EKS 컴퓨팅 노드 연결 역할 정책에 추가하는 것입니다.
- 명령: Amazon EKS 인스턴스 역할에 IAM 정책을 추가하려면 다음 명령을 실행합니다.
export instanceId=$(aws ec2 describe-instances \\ --filters Name=instance-type,Values=t3.medium \\ --query "Reservations[0].Instances[*].InstanceId" \\ --output text) export instanceProfileArn=$(aws ec2 describe-instances \\ --instance-ids $instanceId \\ --query 'Reservations[*].Instances[*].IamInstanceProfile.Arn' \\ --output text) export instanceProfileName=$(echo $instanceProfileArn | \\ awk -F/ '{print $NF}') export roleName=$(aws iam get-instance-profile \\ --instance-profile-name $instanceProfileName \\ --query "InstanceProfile.Roles[*].RoleName" \\ --output text) sudo chmod +x ~/environment/eksLabRepo/containerInsights.sh ~/environment/eksLabRepo/./containerInsights.sh
사전 조건에 관한 자세한 내용은 Container Insights - 사전 조건 확인을 참조하십시오.
- 명령: CloudWatch Container Insights를 Amazon EKS 클러스터에 배포하려면 다음 명령을 실행합니다.
export CLUSTER_NAME=$(aws eks describe-cluster \\ --name eks-lab-cluster \\ --query 'cluster.name' \\ --output text) curl <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}}/$CLUSTER_NAME/;s/{{region_name}}/$AWS_DEFAULT_REGION/" | \\ kubectl apply -f -
예상 출력:
****************************** **** This is OUTPUT ONLY. **** ****************************** % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16515 100 16515 0 0 86834 0 --:--:-- --:--:-- --:--:-- 86921 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
CloudWatch Container Insights는 클러스터 데이터를 완전히 배포하고 표시하는 데 8~10분이 소요될 수 있습니다. 다음 단계를 진행하기 전에 배포가 완료될 때까지 기다리십시오.
- CloudWatch 서비스에 액세스하려면 AWS Management Console의 Services 메뉴에서 Management & Governance를 선택한 다음, CloudWatch를 선택합니다.
- 탐색 창에서 Insights를 선택한 후 Container Insights를 선택합니다.
IAM 권한 오류가 발견되면 경고를 무시하고 다음 단계를 계속 진행할 수 있습니다.
- Kubernetes 환경의 지도를 보려면 오른쪽 상단 영역에서 Map view를 선택합니다.
- Select a cluster 필드에 커서를 놓고 드롭다운 메뉴에서 eks-lab-cluster를 선택합니다.
- Select a node 필드에 커서를 놓고 드롭다운 메뉴에서 containers-lab 네임스페이스를 선택합니다. containers-lab 네임스페이스의 리소스를 표시하도록 맵이 업데이트되고 화면 하단의 지표 패널에는 CPU 사용률, 메모리 사용률 및 네트워크 통계가 표시됩니다.
PU, 메모리 및 네트워크 사용률을 보여주는 지표 페이지를 확인하십시오.
이 실습에서는 대시보드를 볼 때 표시되는 IAM 권한 오류를 무시해도 됩니다.
Amazon EKS의 CloudWatch Container Insights에 대해 자세히 알아보려면 Amazon EKS 및 Kubernetes의 Container Insights에 대한 Quick Start 설정을 참조하십시오.
결론
축하합니다! 이제 다음 태스크를 수행할 수 있어야 합니다.
- AWS Cloud9 작업 공간을 준비합니다.
- Amazon EKS 클러스터를 생성합니다.
- Docker 애플리케이션을 준비하여 Amazon ECR 리포지토리로 푸시합니다.
- AWS Load Balancer Controller를 배포합니다.
- Amazon EKS 클러스터에 애플리케이션을 배포합니다.
- Kubernetes 클러스터에서 CloudWatch Container Insights를 구성하고 확인합니다.
실습 종료
다음 단계에 따라 콘솔을 닫고 실습을 종료합니다.
- AWS Management Console로 돌아갑니다.
- 페이지 오른쪽 상단에서 AWSLabsUser를 선택하고 Sign out을 선택합니다.
- 실습 종료를 선택한 다음 실습을 종료할 것임을 확인합니다.
추가 리소스
- AWS 워크숍 - Kubernetes 소개
- Amazon EKS 클러스터 생성
- Amazon EKS용 kubeconfig 생성
- Kubernetes kubectl 치트 시트
AWS Training and Certification에 대한 자세한 내용은 *https://aws.amazon.com/training/*을 참조하십시오.
여러분의 피드백을 환영합니다. 피드백, 제안 사항 또는 수정 요청 사항을 제공하려면 *AWS Training and Certification 문의 양식*에 세부 정보를 입력해 주시기 바랍니다.
태스크 9: Amazon CloudWatch Container Insights 배포
Amazon CloudWatch Container Insights는 컨테이너화된 애플리케이션과 마이크로서비스에서 지표와 로그를 수집하고 집계하며 요약합니다. CloudWatch Container Insights는 Amazon Elastic Container Service(Amazon ECS), Amazon Elastic Kubernetes Service(Amazon EKS) 및 Amazon EC2의 Kubernetes 플랫폼에서 사용할 수 있습니다.
이 태스크에서는 CloudWatch Container Insights를 실습 애플리케이션에 추가하고 그 결과를 검토합니다. 첫 번째 단계는 필수 IAM 정책인 CloudWatchAgentServerPolicy를 Amazon EKS 컴퓨팅 노드 연결 역할 정책에 추가하는 것입니다.
- 명령: Amazon EKS 인스턴스 역할에 IAM 정책을 추가하려면 다음 명령을 실행합니다.
export instanceId=$(aws ec2 describe-instances \\ --filters Name=instance-type,Values=t3.medium \\ --query "Reservations[0].Instances[*].InstanceId" \\ --output text) export instanceProfileArn=$(aws ec2 describe-instances \\ --instance-ids $instanceId \\ --query 'Reservations[*].Instances[*].IamInstanceProfile.Arn' \\ --output text) export instanceProfileName=$(echo $instanceProfileArn | \\ awk -F/ '{print $NF}') export roleName=$(aws iam get-instance-profile \\ --instance-profile-name $instanceProfileName \\ --query "InstanceProfile.Roles[*].RoleName" \\ --output text) sudo chmod +x ~/environment/eksLabRepo/containerInsights.sh ~/environment/eksLabRepo/./containerInsights.sh
사전 조건에 관한 자세한 내용은 Container Insights - 사전 조건 확인을 참조하십시오.
- 명령: CloudWatch Container Insights를 Amazon EKS 클러스터에 배포하려면 다음 명령을 실행합니다.
export CLUSTER_NAME=$(aws eks describe-cluster \\ --name eks-lab-cluster \\ --query 'cluster.name' \\ --output text) curl <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}}/$CLUSTER_NAME/;s/{{region_name}}/$AWS_DEFAULT_REGION/" | \\ kubectl apply -f -
예상 출력:
****************************** **** This is OUTPUT ONLY. **** ****************************** % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16515 100 16515 0 0 86834 0 --:--:-- --:--:-- --:--:-- 86921 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
CloudWatch Container Insights는 클러스터 데이터를 완전히 배포하고 표시하는 데 8~10분이 소요될 수 있습니다. 다음 단계를 진행하기 전에 배포가 완료될 때까지 기다리십시오.
- CloudWatch 서비스에 액세스하려면 AWS Management Console의 Services 메뉴에서 Management & Governance를 선택한 다음, CloudWatch를 선택합니다.
- 탐색 창에서 Insights를 선택한 후 Container Insights를 선택합니다.
IAM 권한 오류가 발견되면 경고를 무시하고 다음 단계를 계속 진행할 수 있습니다.
- Kubernetes 환경의 지도를 보려면 오른쪽 상단 영역에서 Map view를 선택합니다.
- Select a cluster 필드에 커서를 놓고 드롭다운 메뉴에서 eks-lab-cluster를 선택합니다.
- Select a node 필드에 커서를 놓고 드롭다운 메뉴에서 containers-lab 네임스페이스를 선택합니다. containers-lab 네임스페이스의 리소스를 표시하도록 맵이 업데이트되고 화면 하단의 지표 패널에는 CPU 사용률, 메모리 사용률 및 네트워크 통계가 표시됩니다.
PU, 메모리 및 네트워크 사용률을 보여주는 지표 페이지를 확인하십시오.
이 실습에서는 대시보드를 볼 때 표시되는 IAM 권한 오류를 무시해도 됩니다.
Amazon EKS의 CloudWatch Container Insights에 대해 자세히 알아보려면 Amazon EKS 및 Kubernetes의 Container Insights에 대한 Quick Start 설정을 참조하십시오.
결론
축하합니다! 이제 다음 태스크를 수행할 수 있어야 합니다.
- AWS Cloud9 작업 공간을 준비합니다.
- Amazon EKS 클러스터를 생성합니다.
- Docker 애플리케이션을 준비하여 Amazon ECR 리포지토리로 푸시합니다.
- AWS Load Balancer Controller를 배포합니다.
- Amazon EKS 클러스터에 애플리케이션을 배포합니다.
- Kubernetes 클러스터에서 CloudWatch Container Insights를 구성하고 확인합니다.
실습 종료
다음 단계에 따라 콘솔을 닫고 실습을 종료합니다.
- AWS Management Console로 돌아갑니다.
- 페이지 오른쪽 상단에서 AWSLabsUser를 선택하고 Sign out을 선택합니다.
- 실습 종료를 선택한 다음 실습을 종료할 것임을 확인합니다.
추가 리소스
- AWS 워크숍 - Kubernetes 소개
- Amazon EKS 클러스터 생성
- Amazon EKS용 kubeconfig 생성
- Kubernetes kubectl 치트 시트
AWS Training and Certification에 대한 자세한 내용은 *https://aws.amazon.com/training/*을 참조하십시오.
여러분의 피드백을 환영합니다. 피드백, 제안 사항 또는 수정 요청 사항을 제공하려면 *AWS Training and Certification 문의 양식*에 세부 정보를 입력해 주시기 바랍니다.
다음글이전글이전 글이 없습니다.댓글