일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- Model Serving
- kubernetes operator
- CANARY
- 오퍼레이터
- nginx ingress
- 카오스 엔지니어링
- operator
- Litmus
- Kubeflow
- gitops
- Kopf
- Continuous Deployment
- keda
- tekton
- mlops
- eBPF
- blue/green
- serving
- Kubernetes
- MLflow
- Argo
- seldon core
- opensearch
- Kubernetes 인증
- CI/CD
- opentelemetry
- Pulumi
- argocd
- xdp
- knative
- Today
- Total
Kubernetes 이야기
OpenCost 본문
OpenCost는 인프라 및 컨테이너 비용을 측정하고 할당하기 위한 벤더 중립적 오픈 소스 프로젝트이다. Kubernetes 비용 모니터링용으로 구축되어 실시간 비용 모니터링을 지원한다.
https://github.com/opencost/opencost
GitHub - opencost/opencost: Cross-cloud cost allocation models for Kubernetes workloads
Cross-cloud cost allocation models for Kubernetes workloads - GitHub - opencost/opencost: Cross-cloud cost allocation models for Kubernetes workloads
github.com
설치
OpenCost는 Prometheus의 데이터를 기반으로 사용량을 산출한다. 자체 Prometheus가 존재하는 경우 설치방법을 알아보자.
Prometheus가 설치 안된 Cluster 환경인 경우
helm install my-prometheus --repo https://prometheus-community.github.io/helm-charts prometheus \
--namespace prometheus --create-namespace \
--set pushgateway.enabled=false \
--set alertmanager.enabled=false \
-f https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/prometheus/extraScrapeConfigs.yaml
kubectl apply --namespace opencost -f https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/opencost.yaml
이미 Prometheus가 설치된 Cluster 환경인 경우
다음의 파일을 다운로드 받은 후 환경 변수 중 값을 Cluster에 설치된 Prometheus 환경에 맞게 수정한다.
wget https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/opencost.yaml
수정을 완료 한 후 yaml을 실행한다.
kubectl create -f opencost.yaml
조회
kubectl cost plugin을 설치해 보자.
os=$(uname | tr '[:upper:]' '[:lower:]') && \
arch=$(uname -m | tr '[:upper:]' '[:lower:]' | sed -e s/x86_64/amd64/) && \
curl -s -L https://github.com/kubecost/kubectl-cost/releases/latest/download/kubectl-cost-$os-$arch.tar.gz | tar xz -C /tmp && \
chmod +x /tmp/kubectl-cost && \
sudo mv /tmp/kubectl-cost /usr/local/bin/kubectl-cost
이제 아래와 같이 비용을 조회해 보자.
kubectl cost --service-port 9003 --service-name opencost --kubecost-namespace opencost --allocation-path /allocation/compute \
namespace \
--window 5m \
--show-efficiency=true
+-------------+-------------------------------+--------------------+-----------------+
| CLUSTER | NAMESPACE | MONTHLY RATE (ALL) | COST EFFICIENCY |
+-------------+-------------------------------+--------------------+-----------------+
| cluster-one | opensearch | 72.709186 | 0.218896 |
| | kube-system | 39.894261 | 0.462041 |
| | keycloak | 6.433897 | 0.234992 |
| | prometheus | 0.000000 | 0.000000 |
| | test | 0.000000 | 0.000000 |
+-------------+-------------------------------+--------------------+-----------------+
| SUMMED | | 138.912759 | |
+-------------+-------------------------------+--------------------+-----------------+
기타
이 OpenCost와 유사한 비용 산정을 하는 kubecost가 존재한다. OpenCost는 이 Kubecost 사에서 오픈소스 프로젝트로 출시한 것이다. OpenCost 구현은 원래 Kubecost에서 구축한 비용 할당 엔진이다. 이 구현은 비용 할당 모델을 구축하기 위해 Kubecost의 모든 버전에서 적극적으로 사용된다. 참고로 Kubecost는 상용 제품이다.
아래는 Kubecost와 Opencost를 비교한 자료이다.
https://docs.kubecost.com/general/opencost-product-comparison
OpenCost Product Comparison - Kubecost Documentation
Includes all features of Kubecost Business, plus: access control with SSO/SAML, custom pricing, advanced integrations, long-term data storage, and expert technical support
docs.kubecost.com
'Kubernetes > 모니터링' 카테고리의 다른 글
Ingress 지표를 이용하여 SLO를 충족하기 위한 서비스 수준 지표 (SLI) (0) | 2022.12.28 |
---|---|
Prometheus를 사용하여 Jenkins 모니터링 (0) | 2022.09.08 |
Prometheus agent mode (0) | 2022.09.03 |
Cilium - Hubble UI를 이용한 애플리케이션 시각화 (0) | 2022.05.19 |
kind + cilium + hubble 구성하기 ( without kube-proxy ) (0) | 2022.05.16 |