cost-analyzer

by Helm

Helm chartv2.5.5App 2.5.5

Kubecost Helm chart - monitor your cloud costs!

About this chart

Kubecost Helm chart

This is the official Helm chart for Kubecost, an enterprise-grade application to monitor and manage Kubernetes spend. Please see the website for more details on what Kubecost can do for you and the official documentation here, or contact [email protected] for assistance.

To install via Helm, run the following command.

helm upgrade --install kubecost -n kubecost --create-namespace \
  --repo https://kubecost.github.io/cost-analyzer/ cost-analyzer \
  --set kubecostToken="aGVsbUBrdWJlY29zdC5jb20=xm343yadf98"

Alternatively, add the Helm repository first and scan for updates.

helm repo add kubecost https://kubecost.github.io/cost-analyzer/
helm repo update

Next, install the chart.

helm install kubecost kubecost/cost-analyzer -n kubecost --create-namespace \
  --set kubecostToken="aGVsbUBrdWJlY29zdC5jb20=xm343yadf98"

While Helm is the recommended install path for Kubecost especially in production, Kubecost can alternatively be deployed with a single-file manifest using the following command. Keep in mind when choosing this method, Kubecost will be installed from a development branch and may include unreleased changes.

kubectl apply -f https://raw.githubusercontent.com/kubecost/cost-analyzer-helm-chart/develop/kubecost.yaml

The following table lists commonly used configuration parameters for the Kubecost Helm chart and their default values. Please see the values file for the complete set of definable values.

ParameterDescriptionDefault
global.prometheus.enabledIf false, use an existing Prometheus install. More info.true
prometheus.server.persistentVolume.enabledIf true, Prometheus server will create a Persistent Volume Claim.true
prometheus.server.persistentVolume.sizePrometheus server data Persistent Volume size. Default set to retain ~6000 samples per second for 15 days.32Gi
prometheus.server.retentionDetermines when to remove old data.15d
prometheus.server.resourcesPrometheus server resource requests and limits.{}
prometheus.nodeExporter.resourcesNode exporter resource requests and limits.{}
prometheus.nodeExporter.enabled prometheus.serviceAccounts.nodeExporter.createIf false, do not crate NodeExporter daemonset.true
prometheus.alertmanager.persistentVolume.enabledIf true, Alertmanager will create a Persistent Volume Claim.true
prometheus.pushgateway.persistentVolume.enabledIf true, Prometheus Pushgateway will create a Persistent Volume Claim.true
persistentVolume.enabledIf true, Kubecost will create a Persistent Volume Claim for product config data.true
persistentVolume.sizeDefine PVC size for cost-analyzer32.0Gi
persistentVolume.dbSizeDefine PVC size for cost-analyzer's flat file database32.0Gi
ingress.enabledIf true, Ingress will be createdfalse
ingress.annotationsIngress annotations{}
ingress.classNameIngress class name{}
ingress.pathsIngress paths["/"]
ingress.hostsIngress hostnames[cost-analyzer.local]
ingress.tlsIngress TLS configuration (YAML)[]
networkCosts.enabledIf true, collect network allocation metrics More infofalse
networkCosts.podMonitor.enabledIf true, a PodMonitor for the network-cost daemonset is createdfalse
serviceMonitor.enabledSet this to true to create ServiceMonitor for Prometheus operatorfalse
serviceMonitor.additionalLabelsAdditional labels that can be used so ServiceMonitor will be discovered by Prometheus{}
serviceMonitor.relabelingsSets Prometheus metric_relabel_configs on the scrape job[]
serviceMonitor.metricRelabelingsSets Prometheus relabel_configs on the scrape job[]
prometheusRule.enabledSet this to true to create PrometheusRule for Prometheus operatorfalse
prometheusRule.additionalLabelsAdditional labels that can be used so PrometheusRule will be discovered by Prometheus{}
grafana.resourcesGrafana resource requests and limits.{}
grafana.serviceAccount.createIf true, create a Service Account for Grafana.true
grafana.serviceAccount.nameGrafana Service Account name.{}
grafana.sidecar.datasources.defaultDatasourceEnabledSet this to false to disable creation of Prometheus datasource in Grafanatrue
serviceAccount.createSet this to false if you want to create the service account kubecost-cost-analyzer on your owntrue
tolerationsnode taints to tolerate[]
affinitypod affinity{}
kubecostProductConfigs.productKey.mountPathUse instead of kubecostProductConfigs.productKey.secretname to declare the path at which the product key file is mounted (eg. by a secrets provisioner)N/A
kubecostFrontend.api.fqdnCustomize the upstream api FQDNcomputed in terms of the service name and namespace
kubecostFrontend.model.fqdnCustomize the upstream model FQDNcomputed in terms of the service name and namespace
clusterController.fqdnCustomize the upstream cluster controller FQDNcomputed in terms of the service name and namespace
global.grafana.fqdnCustomize the upstream grafana FQDNcomputed in terms of the release name and namespace

Adjusting Log Output

The log output can be customized during deployment by using the LOG_LEVEL and/or LOG_FORMAT environment variables.

Adjusting Log Level

Adjusting the log level increases or decreases the level of verbosity written to the log

Deploy cost-analyzer with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cost-analyzer on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcost-analyzer is pinned at v2.5.5 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply