prometheus-stackdriver-exporter
by Prometheus
Stackdriver exporter for Prometheus
About this chart
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
Usage
The chart is distributed as an OCI Artifact as well as via a traditional Helm Repository.
- OCI Artifact:
oci://ghcr.io/prometheus-community/charts/prometheus-stackdriver-exporter - Helm Repository:
https://prometheus-community.github.io/helm-chartswith chartprometheus-stackdriver-exporter
The installation instructions use the OCI registry. Refer to the [helm repo](helm repo) command documentation for information on installing charts via the traditional repository.
Install Chart
# Helm 3
$ helm install [RELEASE_NAME] oci://ghcr.io/prometheus-community/charts/prometheus-stackdriver-exporter --set 'stackdriver.projectIds[0]=google-project-name'
# Helm 2
$ helm install --name [RELEASE_NAME] oci://ghcr.io/prometheus-community/charts/prometheus-stackdriver-exporter --set 'stackdriver.projectIds[0]=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.
4.x to 5.x
The deprecated stackdriver.projectId and
stackdriver.metrics.typePrefixes parameters have been removed.
Replace:
stackdriver:
projectId: my-project
metrics:
typePrefixes: compute.googleapis.com/instance/cpu
with:
stackdriver:
projectIds:
- my-project
metrics:
prefixes:
- compute.googleapis.com/instance/cpu
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 oci://ghcr.io/prometheus-community/charts/prometheus-stackdriver-exporter
# Helm 3
$ helm show values oci://ghcr.io/prometheus-community/charts/prometheus-stackdriver-exporter
Tip: You can use the default values.yaml, as long as you provide a value for stackdriver.projectIds.
Namespace Override
Set namespaceOverride to deploy chart resources into a namespace different from the Helm release namespace.
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.
Deploy prometheus-stackdriver-exporter with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prometheus-stackdriver-exporter 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartprometheus-stackdriver-exporter is pinned at v5.3.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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