metrics-accumulator

by ducthangqd1998

Helm chartv0.1.6App 2.0.1Apache-2.0Verified publisher

A Helm chart for metrics-accumulator - an alternative to Prometheus Pushgateway for ephemeral workloads

About this chart

Metrics Accumulator Helm Chart

Background

Ephemeral workloads can be difficult to monitor with tools that assume metrics should remain available until explicitly deleted. This can lead to stale metrics when short-lived jobs finish and no longer update their values.

Metrics Accumulator addresses this use case for ephemeral and short-lived jobs (AWS Lambda, Cloud Run, Kubernetes Jobs, CronJobs). This chart packages Metrics Accumulator for deployment on Kubernetes with Helm.

Special thanks to bpoole6 for creating the Metrics Accumulator project.

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.0+

Installing the Chart

To install the chart with the release name my-metrics-accumulator:

helm repo add thangmai-charts https://ducthangqd1998.github.io/charts
helm repo update
helm install my-metrics-accumulator thangmai-charts/metrics-accumulator

Or install directly from source:

git clone https://github.com/ducthangqd1998/charts.git
cd charts
helm install my-metrics-accumulator ./charts/metrics-accumulator

Uninstalling the Chart

helm uninstall my-metrics-accumulator

Configuration

Basic Configuration

ParameterDescriptionDefault
replicaCountNumber of replicas (ignored when autoscaling.enabled: true)1
image.repositoryImage repositorybpoole6/metrics-accumulator
image.tagImage tag (defaults to Chart.appVersion)"" (2.0.1)
image.pullPolicyImage pull policyIfNotPresent
nameOverrideOverride chart name""
fullnameOverrideOverride chart fullname""
commonLabelsLabels applied to all rendered resources{}

ServiceAccount & Security (PSS Restricted)

ParameterDescriptionDefault
serviceAccount.createCreate service accounttrue
serviceAccount.automountAutomount ServiceAccount tokenfalse
serviceAccount.annotationsService account annotations{}
serviceAccount.nameService account name""
podSecurityContextPod security context (runAsNonRoot: true, UID 10001, seccompProfile: RuntimeDefault)Restricted defaults
securityContextContainer security context (readOnlyRootFilesystem: true, allowPrivilegeEscalation: false, capabilities.drop: [ALL])Restricted defaults

Service & Ingress

ParameterDescriptionDefault
service.typeService typeClusterIP
service.portService port8080
service.targetPortContainer port8080
service.annotationsService annotations{}
ingress.enabledEnable networking.k8s.io/v1 Ingressfalse
ingress.classNameIngressClass name""
ingress.annotationsIngress annotations{}
ingress.hostsIngress host rulesSee values.yaml
ingress.tlsIngress TLS configuration[]

Resources, Lifecycle & Probes

ParameterDescriptionDefault
resources.requestsCPU and memory requestscpu: 100m, memory: 256Mi
resources.limitsMemory limitmemory: 512Mi
startupProbeHTTP GET probe on /service-discovery (port: http)Enabled
livenessProbeHTTP GET probe on /service-discovery (port: http)Enabled
readinessProbeHTTP GET probe on /service-discovery (port: http)Enabled
lifecycleContainer lifecycle hookspreStop: sleep 10
terminationGracePeriodSecondsPod termination grace period60

Autoscaling, Persistence & Observability

ParameterDescriptionDefault
autoscaling.enabledEnable autoscaling/v2 HorizontalPodAutoscalerfalse
autoscaling.minReplicasMinimum replicas2
autoscaling.maxReplicasMaximum replicas10
autoscaling.targetCPUUtilizationPercentageTarget CPU utilization80
persistence.enabledEnable PVC storage (ReadWriteOnce requires single replica or ReadWriteMany StorageClass)false
persistence.accessModePVC access modeReadWriteOnce
persistence.sizeStorage size1Gi
persistence.mountPathContainer mount path/data
serviceMonitor.enabledCreate Prometheus Operator ServiceMonitorfalse
serviceMonitor.intervalScrape interval30s
serviceMonitor.scrapeTimeoutScrape timeout10s
serviceMonitor.pathMetrics scrape path (/metrics/{metricGroup})/metrics/default
serviceMonitor.honorLabelsPreserve pushed metric labels on scrapetrue
networkPolicy.enabledEnable NetworkPolicyfalse
podDisruptionBudget.enabledEnable PodDisruptionBudget (minAvailable: 1 default)false
configRaw YAML configuration mounted at /etc/metrics-accumulator/metrics-accumulator.yml""

Secure Configuration & API Keys

Security Warning: Never commit plaintext apiKey secrets inside values.yaml (config). For production deployments, store your metrics-accumulator.yml containing apiKey values in a Kubernetes Secret (managed by External Secrets Operator, Vault, or SealedSecrets), mount it via volumes + volumeMounts, and pass --config-file=/etc/metrics-accumulator-secret/metrics-accumulator.yml in extraArgs (or inject environment variables via extraEnv / extraEnvFrom).

When config is non-empty, the chart automatically:

  1. Renders a ConfigMap (<fullname>-config).
  2. Mounts it read-only at /etc/metrics-accumulator/metrics-accumulator.yml.
  3. Passes --config-file=/etc/metrics-accumulator/metrics-accumulator.yml to container args.
  4. Annotates Pod templates with checksum/config so config updates trigger a rolling restart.

Usage

Pushing Metrics (/update/{metricGroup})

Metrics Accumulator accepts Prometheus text exposition payloads via POST /update/{metricGroup} authenticated with the X-API-KEY header:

curl -X POST "http://metrics-accumulator:8080/update/default" \
  -H "X-API-KEY: <your-metric-group-api-key>" \
  -H "Content-Type: text/plain" \
  --data-binary $'# TYPE lambda_invocations_total counter\nlambda_invocations_total{function="billing"} 1.0\n'

Viewing Metrics (/metrics/{metricGroup})

curl "http://metrics-accumulator:8080/metrics/default"

Configuring Prometheus (/service-discovery or Static Scrape)

Metrics Accumulator exposes a native Prometheus HTTP Service Discovery endpoint at /service-discovery:

scrape_configs:
  - job_name: 'metrics-accumulator'
    honor_labels: true
    http_sd_configs:
      - url: 'http://metrics-accumulator.default.svc.cluster.local:8080/service-discovery'

Or scrape a specific metric group directly:

scrape_configs:
  - job_name: 'metrics-accumulator-default'
    metrics_path: '/metrics/default'
    honor_labels: true
    static_configs:
      - targets: ['metrics-accumulator.default.svc.cluster.local:8080']

Troubleshooting

kubectl get pods -l app.kubernetes.io/name=metrics-accumulator
kubectl logs -l app.kubernetes.io/name=metrics-accumulator
kubectl get svc -l app.kubernetes.io/name=metrics-accumulator

Contributing

Please read CONTRIBUTING.md for details on submitting pull requests.

License

This chart is distributed under the Apache 2.0 License.

Deploy metrics-accumulator with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has metrics-accumulator 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 chartmetrics-accumulator is pinned at v0.1.6 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