Skip to content
项目

关于

将 Helm 统计数据导出为 Prometheus 格式。

系统与基础设施

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Helm Exporter

Docker Registry 

Exports helm release, chart, and version statistics in the prometheus format.

Installation

Prerequisites

  • Kubernetes 1.19+
  • Helm 3+

Get Repo Info

helm repo add sstarcher https://shanestarcher.com/helm-charts/
helm repo update

See helm repo for command documentation.

Install Chart

# Helm
$ helm install helm-exporter sstarcher/helm-exporter

Configuration for Latest versions

Two options exist for fetching the latest version information for a chart.

  • Direct fetch from a chart repository. This will download the index for the registry and use that information to fetch the chart.
# Helm configuration
config:
  helmRegistries:
    overrideChartNames: {}
      mysql: stable/test
# If the helm charts are not stored on hub.helm.sh then a custom registry can be configured here.
# Currently only index.yaml registry is supported (helm supports other registries as well)
    override:
      - registry:
          url: "https://some.url" # Url to the index file
        charts: # Chart names
        - splunk
        - falco-eks-audit-bridge

Configuration for password protected registries

If the registry needs authentication then you can use a Kubernetes secret to store the username and password.

kubectl create secret generic chartmuseum --from-literal=username=admin --from-literal=password=admin

And use following configuration:

# Helm configuration
config:
  helmRegistries:
    overrideChartNames: {}
      mysql: stable/test
    # If the helm charts are not stored on hub.helm.sh then a custom registry can be configured here.
    # Currently only index.yaml registry is supported (helm supports other registries as well)
    override:
      - registry:
          url: "https://some.url" # Url to the index file
          secretRef:
              name: "chartmuseum" # Name of the secret containing the username and password
              userKey: "username" # Key of the username in the secret
              passKey: "password" # Key of the password in the secret
        charts: # Chart names
          - splunk
          - falco-eks-audit-bridge
  • Query https://artifacthub.io for the chart matching your chart name and only using the specified registries. If no registry name is specified and multiple charts match from helm hub no version will be found and it will log a warning.
# Helm configuration
config:
  helmRegistries:
    registryNames:
    - bitnami

Configuration for OCI registries

Registries can also be configured as OCI (Open Container Initiative) registries by prefixing the url with oci://. helm-exporter lists the tags published to the chart's OCI repository and reports the highest one as the latest version, the same way helm pull oci://... resolves chart versions.

# Helm configuration
config:
  helmRegistries:
    override:
      - registry:
          url: "oci://registry.example.com/helm" # OCI registry, no index.yaml involved
        charts: # Chart names
        - kube-prometheus-stack
      - registry:
          url: "oci://ghcr.io/prometheus-community/charts"
        charts:
        - kube-prometheus-stack

Private OCI registries are supported the same way helm itself supports them: run helm registry login registry.example.com on a host (or in an init step) before starting helm-exporter, or point HELM_REGISTRY_CONFIG at an existing Helm registry credentials file. helm-exporter does not introduce a separate authentication mechanism for OCI - it reuses whatever credentials the Helm CLI would use.

Metrics

Format

# HELP helm_chart_info Information on helm releases
# TYPE helm_chart_info gauge
helm_chart_info{chart="ark",release="ark",version="1.2.1",latestVersion="1.2.3",appVersion="1.2.3",updated="1553201431",namespace="test"} 1
helm_chart_info{chart="cluster-autoscaler",release="cluster-autoscaler",version="0.7.0",latestVersion=7.3.2,appVersion="",updated="1553201431",namespace="other"} 4
helm_chart_info{chart="dex",release="dex",version="0.1.0",latestVersion="3.4.0",appVersion="1.2.3",updated="1553201431",namespace="test"} 1

# HELP helm_chart_outdated Outdated helm versions of helm releases
# TYPE helm_chart_outdated gauge
helm_chart_outdated{chart="ark",latestVersion="1.2.3",namespace="test",release="ark",version="1.2.1"} 1
helm_chart_outdated{chart="cluster-autoscaler",latestVersion="7.3.2",namespace="other",release="cluster-autoscaler",version="0.7.0"} 1
helm_chart_outdated{chart="external-secrets",latestVersion="3.4.0",namespace="test",release="dex",version="0.1.0"} 1

# HELP helm_chart_timestamp Timestamps of helm releases
# TYPE helm_chart_timestamp gauge
helm_chart_timestamp{chart="ark",release="ark",version="1.2.1",latestVersion="1.2.3",appVersion="1.2.3",updated="1553201431",namespace="test"} 1.617197959e+12
helm_chart_timestamp{chart="cluster-autoscaler",release="cluster-autoscaler",version="0.7.0",latestVersion=7.3.2,appVersion="",updated="1553201431",namespace="other"} 1.617196128e+12
helm_chart_timestamp{chart="dex",release="dex",version="0.1.0",latestVersion="3.4.0",appVersion="1.2.3",updated="1553201431",namespace="test"} 1.62245881e+12

The metric value is the helm status code. These status codes indexes do not map up directly to helm. This is so I can make the bad cases negative values.

  • -1 FAILED
  • 0 UNKNOWN
  • 1 DEPLOYED
  • 2 DELETED
  • 3 SUPERSEDED
  • 5 DELETING
  • 6 PENDING_INSTALL
  • 7 PENDING_UPGRADE
  • 8 PENDING_ROLLBACK

Prior Art

Todo

  • /healthz endpoint method

探索相关项目

加载中…