- Fluentbit Sidecar2024년 12월 27일
- wngnl05
- 작성자
- 2024.12.27.:12
NameSpace
kubectl create ns fluentd
Apply CloudWatch-Namespace
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
CLUSTER_NAME=<클러스터 이름> REGION=<리전> FluentBitHttpPort='2020' FluentBitReadFromHead='Off' [[ ${FluentBitReadFromHead} = 'On' ]] && FluentBitReadFromTail='Off'|| FluentBitReadFromTail='On' [[ -z ${FluentBitHttpPort} ]] && FluentBitHttpServer='Off' || FluentBitHttpServer='On' kubectl create configmap fluent-bit-cluster-info --from-literal=cluster.name=${CLUSTER_NAME} --from-literal=http.server=${FluentBitHttpServer} --from-literal=http.port=${FluentBitHttpPort} --from-literal=read.head=${FluentBitReadFromHead} --from-literal=read.tail=${FluentBitReadFromTail} --from-literal=logs.region=${REGION} -n amazon-cloudwatch
Create IAM Service Account
eksctl create iamserviceaccount --name fluentd --region $REGION --cluster $CLUSTER_NAME --namespace fluentd --attach-policy-arn arn:aws:iam::aws:policy/CloudWatchFullAccess --override-existing-serviceaccounts --approve
Create Config MAP
kubectl create configmap cluster-info --from-literal=cluster.name=$CLUSTER_NAME --from-literal=logs.region=$REGION -n fluentd
Create Namespace
cat <<\EOF> fluentd-ns.yaml kind: Namespace apiVersion: v1 metadata: name: fluentd labels: aws-observability: enabled EOF kubectl apply -f fluentd-ns.yaml
Down File & Apply
wget https://raw.githubusercontent.com/wngnl-dev/AWS/main/EKS/SideCar/fluentd.yaml wget https://raw.githubusercontent.com/wngnl-dev/AWS/main/EKS/SideCar/service.yaml wget https://raw.githubusercontent.com/wngnl-dev/AWS/main/EKS/SideCar/service-cm.yaml wget https://raw.githubusercontent.com/wngnl-dev/AWS/main/EKS/SideCar/deployment.yaml kubectl apply -f fluentd.yaml kubectl apply -f service.yaml
서비스를 확인하고 "CLUSTER-IP"를 복사해서 service-cm.yaml에 넣어주세요.
kubectl get svc -n fluentd
deployment에 ECR URL을 추가하고
kubectl apply -f deployment.yaml kubectl apply -f service-cm.yaml
Container 에 Curl 요청
date kubectl exec -it -n app deployment.apps/service-a -- curl localhost:8080 > /dev/null 2>&1 kubectl exec -it -n app deployment.apps/service-b -- curl localhost:8080 > /dev/null 2>&1 kubectl exec -it -n app deployment.apps/service-c -- curl localhost:8080 > /dev/null 2>&1
'Aws' 카테고리의 다른 글
CodeBuild ID로 ECR 업데이트 및 ECS 서비스 업데이트 하기 (0) 2024.12.27 ECR PULL 차단하기 (0) 2024.12.27 Linux Server에서 OpenSearch로 로그 보내기 (0) 2024.12.27 Dockerfile 로 Python 앱 배포하기 (0) 2024.12.27 EKS CloudWatch Insight (0) 2024.12.27 다음글이전글이전 글이 없습니다.댓글
스킨 업데이트 안내
현재 이용하고 계신 스킨의 버전보다 더 높은 최신 버전이 감지 되었습니다. 최신버전 스킨 파일을 다운로드 받을 수 있는 페이지로 이동하시겠습니까?
("아니오" 를 선택할 시 30일 동안 최신 버전이 감지되어도 모달 창이 표시되지 않습니다.)