
CloudWatchAgentServerPolicy 정책을 추가

CloudWatchAgentServerPolicy 정책을 추가
CloudWatch의 네임스페이스 생성
: amazon-cloudwatch라는 Kubernetes 네임스페이스를 생성
kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/cloudwatch-namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/cwagent/cwagent-serviceaccount.yamlcurl -O https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/cwagent/cwagent-configmap-enhanced.yamlwindows PowerShell 에서는 curl.exe 로 수행cwagent-configmap-enhanced.yaml 파일의 {{cluster_name}} 부분을 클러스터 이름으로 수정
kubectl apply -f cwagent-configmap-enhanced.yamlkubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/cwagent/cwagent-daemonset.yamlkubectl get pods -n amazon-cloudwatch
/aws/containerinsights/eks-work-cluster/performance 디렉토리가 생성되었는지 확인



EC2 인스턴스의 [IAM 역할] - [권한 추가] - [정책 연결] 을 눌러서 CloudWatchAgentServerPolicy 정책을 연결
kubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/cloudwatch-namespace.yamlcluster-info이라는 ConfigMap을 생성kubectl create configmap cluster-info \
--from-literal=cluster.name=cluster_name \
--from-literal=logs.region=region_name -n amazon-cloudwatchkubectl create configmap cluster-info --from-literal=cluster.name=eks-work-cluster --from-literal=logs.region=ap-northeast-2 -n amazon-cloudwatchkubectl apply -f https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/fluentd/fluentd.yamlkubectl get pods -n amazon-cloudwatch

