<8> kubecost 1 목표 kubecost로 컨테이너 비용에 대해 알아보자. 2 kubecost 개요 https://www.opencost.io/ penCost 링크를 기반으로 구축 쿠버네티스 리소스별 비용 분류 가시화 제공 https://www.kubecost.com/pricing/ 가격 Free(메트릭 15일 보존 아키텍처 https://docs.kubecost.com/install-and-configure/install/provider-installations/aws-eks-cost-monitoring 수집 https://aws.amazon.com/ko/blogs/containers/aws-and-kubecost-collaborate-to-deliver-cost-monitoring-for-eks-customers/ 3 설치와 접속 https://docs.kubecost.com/install-and-configure/install/provider-installations/aws-eks-cost-monitoring https://github.com/kubecost/cost-analyzer-helm-chart/blob/develop/cost-analyzer/values-eks-cost-monitoring.yaml https://gallery.ecr.aws/kubecost/cost-analyzer ngress, service(nlb) 통한 접속은 실패 - 테스트 해보세요 bastion ec2를 통한 ssh port forwarding 통한 접속 방식으로 우회 https://docs.kubecost.com/install-and-configure/install/ingress-examples https://catalog.workshops.aws/eks-immersionday/en-US/kubecost/configure-ingress 4 # cat < cost-values.yaml global: grafana: enabled: true proxy: false priority: enabled: false networkPolicy: enabled: false podSecurityPolicy: enabled: false persistentVolume: storageClass: "gp3" prometheus: kube-state-metrics: disabled: false nodeExporter: enabled: true reporting: productAnalytics: true EOT # kubecost chart 에 프로메테우스가 포함되어 있으니, 기존 프로메테우스-스택은 삭제하자 : node-export 포트 충돌 발생 helm uninstall -n monitoring kube-prometheus-stack # 배포 kubectl create ns kubecost helm install kubecost oci://public.ecr.aws/kubecost/cost-analyzer --version 1.103.2 --namespace kubecost -f cost-values.yaml # 배포 확인 kubectl get-all -n kubecost kubectl get all -n kubecost 5 # kubecost-cost-analyzer 파드 IP변수 지정 및 접속 확인 CAIP=$(kubectl get pod -n kubecost -l app=cost-analyzer -o jsonpath={.items[0].status.podIP}) curl -s $CAIP:9090 6 # 외부에서 bastion EC2 접속하여 특정 파드 접속 방법 : socat(SOcket CAT) 활용 - 링크 yum -y install socat socat TCP-LISTEN:80,fork TCP:$CAIP:9090 웹 브라우저에서 bastion EC2 IP로 접속