|
| 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) |
0 commit comments