1. EKS Log 종류
- EKS
- Control Plane
- Node
- Application
2. EKS Log 활성화 옵션
- EKS > Observability
- Kubernetes API server component logs (**api**) – kube-apiserver-<nnn...>
- Audit (**audit**) – kube-apiserver-audit-<nnn...>
- Authenticator (**authenticator**) – authenticator-<nnn...>
- Controller manager (**controllerManager**) – kube-controller-manager-<nnn...>
- Scheduler (**scheduler**) – kube-scheduler-<nnn...>
# 모든 로깅 활성화
aws eks update-cluster-config --region $AWS_DEFAULT_REGION --name $CLUSTER_NAME \
--logging '{"clusterLogging":[{"types":["api","audit","authenticator","controllerManager","scheduler"],"enabled":true}]}'
# 로그 그룹 확인
aws logs describe-log-groups | jq
# 로그 그룹 확인 - logGroupName에 myeks를 포함하는 것만 필터링
aws logs describe-log-groups --query "logGroups[?contains(logGroupName, 'myeks')]" | jq
# 로그 tail 확인 : aws logs tail help
aws logs tail /aws/eks/$CLUSTER_NAME/cluster | more
# 신규 로그를 바로 출력
aws logs tail /aws/eks/$CLUSTER_NAME/cluster --follow
# 필터 패턴
aws logs tail /aws/eks/$CLUSTER_NAME/cluster --filter-pattern <필터 패턴>
# 로그 스트림이름
aws logs tail /aws/eks/$CLUSTER_NAME/cluster --log-stream-name-prefix <로그 스트림 prefix> --follow
aws logs tail /aws/eks/$CLUSTER_NAME/cluster --log-stream-name-prefix kube-controller-manager --follow
kubectl scale deployment -n kube-system coredns --replicas=1
kubectl scale deployment -n kube-system coredns --replicas=2
# 시간 지정: 1초(s) 1분(m) 1시간(h) 하루(d) 한주(w)
aws logs tail /aws/eks/$CLUSTER_NAME/cluster --since 1h30m
# 짧게 출력
aws logs tail /aws/eks/$CLUSTER_NAME/cluster --since 1h30m --format short