로그 수집은 Cloudwatch agent, 전송은 Fluent Bit이 담당하는 구조로 구성
Fluent Bit은 DaemonSet 형태로 설치한다
- Cloudwatch agent, Fluent Bit 설치할 NS 생성
kubectl create ns amazon-cloudwatch
# 한 줄씩 복사 & 붙여넣기
# 클러스터 이름 입력
ClusterName=MyCluster
# 리전 이름 입력
RegionName=YOUR_REGION
FluentBitHttpPort='2020'
FluentBitReadFromHead='Off'
[[ ${FluentBitReadFromHead} = 'On' ]] && FluentBitReadFromTail='Off'|| FluentBitReadFromTail='On'
[[ -z ${FluentBitHttpPort} ]] && FluentBitHttpServer='Off' || FluentBitHttpServer='On'
wget https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/quickstart/cwagent-fluent-bit-quickstart.yaml
sed -i 's/{{cluster_name}}/'${ClusterName}'/;s/{{region_name}}/'${RegionName}'/;s/{{http_server_toggle}}/"'${FluentBitHttpServer}'"/;s/{{http_server_port}}/"'${FluentBitHttpPort}'"/;s/{{read_from_head}}/"'${FluentBitReadFromHead}'"/;s/{{read_from_tail}}/"'${FluentBitReadFromTail}'"/' cwagent-fluent-bit-quickstart.yaml
kubectl apply -f cwagent-fluent-bit-quickstart.yaml
# 생성된 파드 확인
kubectl get po -n amazon-cloudwatch
# 데몬셋 확인
kubectl get daemonsets -n amazon-cloudwatch