Installation
Installation Methods
Section titled “Installation Methods”Helm Chart Installation
Section titled “Helm Chart Installation”The recommended way to deploy GreenKube in a production Kubernetes cluster.
-
Add the Helm repository
Terminal window helm repo add greenkube https://GreenKubeCloud.github.io/GreenKubehelm repo update -
Create a values file
Create
my-values.yamlto customize your deployment:my-values.yaml secrets:# Get your API token from https://www.electricitymaps.com/electricityMapsToken: "YOUR_TOKEN_HERE"config:cloudProvider: aws # aws, gcp, azure, ovh, scalewaydefaultZone: FR # Fallback carbon zone (ISO 3166-1)# Uncomment to manually set Prometheus URL# prometheus:# url: "http://prometheus-k8s.monitoring.svc.cluster.local:9090"# Uncomment to manually set OpenCost URL# opencost:# url: "http://opencost.opencost.svc.cluster.local:9003"db:type: postgres # postgres (recommended), sqlite, elasticsearchpostgres:enabled: truepersistence:enabled: truesize: 5Gi -
Install the chart
Terminal window helm install greenkube greenkube/greenkube \-f my-values.yaml \-n greenkube \--create-namespace -
Verify the installation
Terminal window kubectl get all -n greenkube
Upgrading
Section titled “Upgrading”helm repo updatehelm upgrade greenkube greenkube/greenkube \ -f my-values.yaml \ -n greenkubeUninstalling
Section titled “Uninstalling”helm uninstall greenkube -n greenkubekubectl delete namespace greenkubeInstallation from Source
Section titled “Installation from Source”For development or contributing to GreenKube.
-
Clone the repository
Terminal window git clone https://github.com/GreenKubeCloud/GreenKube.gitcd GreenKube -
Create a virtual environment
Terminal window python -m venv .venvsource .venv/bin/activate -
Install dependencies
Terminal window pip install -e '.[test,dev]' -
Run tests
Terminal window pytest -
Start the API server
Terminal window greenkube-api
Prerequisites
Section titled “Prerequisites”Required Services
Section titled “Required Services”| Service | Purpose | How to Install |
|---|---|---|
| Prometheus | Metrics collection (CPU, memory, network, disk) | kube-prometheus-stack |
| OpenCost | Cost allocation data | OpenCost Helm Chart |
Service Auto-Discovery
Section titled “Service Auto-Discovery”GreenKube automatically discovers Prometheus and OpenCost services in your cluster by probing common service names and namespaces. If auto-discovery fails (custom naming or namespace), set the URLs manually:
# In your values.yamlconfig: prometheus: url: "http://prometheus-server.monitoring.svc.cluster.local:9090" opencost: url: "http://opencost.opencost.svc.cluster.local:9003"Helm Chart Components
Section titled “Helm Chart Components”The Helm chart deploys the following resources:
| Resource | Description |
|---|---|
Deployment | GreenKube application (collector + API + dashboard) |
Service | Exposes the API on port 8000 |
ConfigMap | Non-sensitive configuration |
Secret | API tokens and database credentials |
ServiceAccount | Identity for pod RBAC |
ClusterRole | Read access to nodes, pods, namespaces |
ClusterRoleBinding | Binds ClusterRole to ServiceAccount |
StatefulSet | PostgreSQL database (if enabled) |
PersistentVolumeClaim | Database storage (if persistence enabled) |
Job (post-install hook) | Database schema initialization |
Resource Requirements
Section titled “Resource Requirements”Minimum
Section titled “Minimum”resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512MiRecommended (Production)
Section titled “Recommended (Production)”resources: requests: cpu: 250m memory: 256Mi limits: cpu: 1000m memory: 1GiNetworking
Section titled “Networking”The API server listens on port 8000 by default. Access methods:
- Port-forward (development):
kubectl port-forward svc/greenkube-api 8000:8000 -n greenkube - LoadBalancer: Set
service.type: LoadBalancerin values.yaml - Ingress: Configure an Ingress resource pointing to the service
- NodePort: Set
service.type: NodePortfor direct node access