Skip to content

Commit ba0ddcb

Browse files
author
ManiDeepakThumu
committed
Add Kubecost helm chart files for dev cluster
1 parent 3b56546 commit ba0ddcb

File tree

3 files changed

+184
-0
lines changed

3 files changed

+184
-0
lines changed

charts/kubecost/Chart.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: v2
2+
appVersion: "2.6.3"
3+
description: A Helm chart for Kubecost cost analyzer. This chart is an overlay for the official cost-analyzer chart with custom resource limits configured for RADAR-K8s environments.
4+
name: kubecost
5+
version: 1.0.0
6+
sources:
7+
- https://github.com/RADAR-base/radar-helm-charts/tree/main/charts/kubecost
8+
- https://github.com/kubecost/cost-analyzer-helm-chart
9+
keywords:
10+
- kubecost
11+
- cost-analyzer
12+
- monitoring
13+
- kubernetes
14+
- radar-base
15+
annotations:
16+
artifacthub.io/license: Apache-2.0
17+
deprecated: false
18+
type: application
19+
home: "https://www.kubecost.com"
20+
maintainers:
21+
- email: mani.thumu@kcl.ac.uk
22+
name: Mani Thumu
23+
url: https://www.kcl.ac.uk
24+
- email: yatharth.ranjan@kcl.ac.uk
25+
name: Yatharth Ranjan
26+
url: https://www.kcl.ac.uk/people/yatharth-ranjan
27+
dependencies:
28+
- name: cost-analyzer
29+
repository: https://kubecost.github.io/cost-analyzer/
30+
version: 2.6.3

charts/kubecost/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Kubecost
2+
3+
Kubecost provides real-time cost visibility and insights for Kubernetes clusters.
4+
5+
## Overview
6+
7+
This chart is an overlay for the official [kubecost cost-analyzer](https://github.com/kubecost/cost-analyzer-helm-chart) chart with custom resource limits configured for RADAR-K8s environments.
8+
9+
## Prerequisites
10+
11+
- Kubernetes 1.20+
12+
- Helm 3.8+
13+
- AWS credentials configured for Cost & Usage Report (CUR) access
14+
15+
## Installation
16+
17+
### Dev Cluster
18+
```bash
19+
cd charts/kubecost
20+
helm dependency update
21+
helm upgrade kubecost . -n kubecost --install -f values-dev.yaml
22+
```
23+
24+
### Stage/Prod Clusters
25+
```bash
26+
# TODO: Create values-stage.yaml and values-prod.yaml
27+
helm upgrade kubecost . -n kubecost --install -f values.yaml -f values-stage.yaml
28+
```
29+
30+
## Configuration
31+
32+
### Key Parameters
33+
34+
| Parameter | Description | Default |
35+
|-----------|-------------|---------|
36+
| `kubecostModel.resources.limits.cpu` | CPU limit for cost analyzer | `200m` |
37+
| `kubecostModel.resources.limits.memory` | Memory limit for cost analyzer | `3072Mi` |
38+
| `prometheus.server.resources.limits.cpu` | CPU limit for Prometheus | `100m` |
39+
| `prometheus.server.resources.limits.memory` | Memory limit for Prometheus | `256Mi` |
40+
| `kubecostProductConfigs.athenaBucketName` | S3 bucket for AWS CUR data | `s3://aws-athena-query-results-phidatalab` |
41+
| `kubecostProductConfigs.athenaRegion` | AWS region for Athena | `eu-west-2` |
42+
43+
### AWS Integration
44+
45+
Kubecost requires AWS Cost & Usage Report (CUR) integration to display accurate cloud costs. Ensure the following are configured:
46+
47+
1. AWS CUR exported to S3
48+
2. Athena database created for CUR data
49+
3. Kubernetes secret `cloud-service-key` with AWS credentials
50+
4. EC2 Spot Instance data feed enabled (optional, for spot pricing)
51+
52+
## Accessing Kubecost
53+
### Local Access (Port Forward)
54+
```bash
55+
kubectl port-forward -n kubecost svc/kubecost-cost-analyzer 9090:9090
56+
```
57+
58+
Then visit: http://localhost:9090
59+
60+
**Note:** Keep the terminal running while accessing the UI.
61+
62+
## Resource Limits Rationale
63+
64+
Resource limits are based on actual usage analysis from dev-cluster-1:
65+
66+
- **Cost Analyzer**: 8m CPU / 2370Mi RAM actual → 200m / 3Gi limit (headroom for spikes)
67+
- **Prometheus**: 11m CPU / 181Mi RAM actual → 100m / 256Mi limit
68+
- **Forecasting**: 1m CPU / 145Mi RAM actual → 200m / 512Mi limit
69+
- **Network Costs**: 9m CPU / 4Mi RAM actual → 100m / 256Mi limit per pod
70+
71+
## Maintainers
72+
73+
- Mani Thumu (mani.thumu@kcl.ac.uk)
74+
- Yatharth Ranjan (yatharth.ranjan@kcl.ac.uk)
75+
76+
## References
77+
78+
- [Kubecost Documentation](https://docs.kubecost.com/)
79+
- [Official Chart Repository](https://github.com/kubecost/cost-analyzer-helm-chart)

charts/kubecost/values-dev.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# AWS/ATHENA CONFIGURATION
2+
kubecostProductConfigs:
3+
athenaBucketName: s3://aws-athena-query-results-phidatalab
4+
athenaDatabase: athenacurcfn_phidatalab
5+
athenaProjectID: "030783174579"
6+
athenaRegion: eu-west-2
7+
athenaTable: phidatalab
8+
athenaWorkgroup: primary
9+
awsSpotDataBucket: phidatalab-spot-instance-data-feed
10+
awsSpotDataRegion: eu-west-2
11+
clusters:
12+
- address: http://127.0.0.1:9090
13+
name: dev-cluster-1
14+
serviceKeySecretName: cloud-service-key
15+
spotLabel: eks.amazonaws.com/capacityType
16+
spotLabelValue: SPOT
17+
18+
# Grafana component
19+
grafana:
20+
enabled: false # Using this setting but pod still exists
21+
resources:
22+
requests:
23+
cpu: 10m
24+
memory: 164Mi
25+
limits:
26+
cpu: 100m
27+
memory: 256Mi
28+
29+
# NETWORK COSTS CONFIGURATION
30+
networkCosts:
31+
enabled: true
32+
replicas: 4
33+
resources:
34+
requests:
35+
cpu: 50m
36+
memory: 20Mi
37+
limits:
38+
cpu: 100m
39+
memory: 256Mi
40+
41+
# PROMETHEUS SERVER CONFIGURATION
42+
prometheus:
43+
server:
44+
global:
45+
external_labels:
46+
cluster_id: dev-cluster-1
47+
resources:
48+
requests:
49+
cpu: 50m
50+
memory: 181Mi
51+
limits:
52+
cpu: 100m
53+
memory: 256Mi
54+
55+
# COST ANALYZER CONFIGURATION
56+
kubecostModel:
57+
resources:
58+
requests:
59+
cpu: 50m
60+
memory: 2500Mi
61+
limits:
62+
cpu: 200m
63+
memory: 3072Mi
64+
65+
# FORECASTING CONFIGURATION
66+
forecasting:
67+
enabled: true
68+
resources:
69+
requests:
70+
cpu: 10m
71+
memory: 150Mi
72+
limits:
73+
cpu: 200m
74+
memory: 512Mi
75+

0 commit comments

Comments
 (0)