Skip to content

Latest commit

 

History

History

prometheus-stackdriver-exporter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Stackdriver Exporter

Prometheus exporter for Stackdriver, allowing for Google Cloud metrics. You must have appropriate IAM permissions for this exporter to work. If you are passing in an IAM key then you must have:

  • monitoring.metricDescriptors.list
  • monitoring.timeSeries.list

These are contained within roles/monitoring.viewer. If you're using legacy access scopes, then you must have https://www.googleapis.com/auth/monitoring.read.

Learn more: https://github.com/prometheus-community/stackdriver_exporter

This chart creates a Stackdriver-Exporter deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.8+ with Beta APIs enabled

Get Helm Repository Info

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

See helm repo for command documentation.

Install Chart

# Helm 3
$ helm install [RELEASE_NAME] prometheus-community/prometheus-stackdriver-exporter --set stackdriver.projectId=google-project-name

# Helm 2
$ helm install --name [RELEASE_NAME] prometheus-community/prometheus-stackdriver-exporter --set stackdriver.projectId=google-project-name

The command deploys Stackdriver-Exporter on the Kubernetes cluster using the default configuration.

See configuration below.

See helm install for command documentation.

Uninstall Chart

# Helm 3
$ helm uninstall [RELEASE_NAME]

# Helm 2
# helm delete --purge [RELEASE_NAME]

This removes all the Kubernetes components associated with the chart and deletes the release.

See helm uninstall for command documentation.

Upgrading Chart

# Helm 3 or 2
$ helm upgrade [RELEASE_NAME] [CHART] --install

See helm upgrade for command documentation.

Upgrading an existing Release to a new major version

A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions.

3.x to 4.x

The Helm parameter stackdriver.metrics.filters is changed to support multiple values instead of a single value. If you are using this parameter, please adjust.

stackdriver:
  metrics:
    filters:
      - filter-1
      - filter-2

2.x to 3.x

Due to a change in deployment labels, removal of its deployment needs to done manually prior to upgrading:

kubectl delete deployments.apps -l app=prometheus-stackdriver-exporter --cascade=orphan

If this is not done, when upgrading via helm (even with helm upgrade --force) an error will occur indicating that the deployment cannot be modified:

invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"example", "app.kubernetes.io/name":"prometheus-stackdriver-exporter"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

Since chart version 3.x, Kubernetes recommended labels have been added.

The following labels are now removed in all manifests (including labels used as selector for Deployment kind):

...
metadata:
  labels:
    app: prometheus-stackdriver-exporter
    chart: prometheus-stackdriver-exporter-2.X.X
    heritage: Helm
    release: example
...
spec:
  ...
  selector:
    matchLabels:
      app: prometheus-stackdriver-exporter
      release: example
...

If you use your own custom ServiceMonitor or PodMonitor, please ensure to upgrade their selector fields accordingly to the new labels.

1.x to 2.x

Since chart version 2.0.0, the exporter is configured via flags/arguments instead of environment variables due to a breaking change in the exporter.

If you already use .Values.extraArgs you might want to check for conflicting command arguments.

Configuration

See Customizing the Chart Before Installing. To see all configurable options with detailed comments, visit the chart's values.yaml, or run these configuration commands:

# Helm 2
$ helm inspect values prometheus-community/prometheus-stackdriver-exporter

# Helm 3
$ helm show values prometheus-community/prometheus-stackdriver-exporter

Tip: You can use the default values.yaml, as long as you provide a value for stackdriver.projectId

Google Storage Metrics

In order to get metrics for GCS you need to ensure the metrics interval is > 24h. You can read more information about this in this bug report.

The easiest way to do this is to create two separate exporters with different prefixes and intervals, to ensure you gather all appropriate metrics.