百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

cert-exporter

> 编程语言
开源

一个 Prometheus 导出器,用于在磁盘和 Kubernetes 秘密中发布证书过期信息

386 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个 Prometheus 导出器,用于在磁盘和 Kubernetes 秘密中发布证书过期信息

cert-exporter

Kubernetes uses PKI certificates for authentication between all major components. These certs are critical for the operation of your cluster but are often opaque to an administrator. This application is designed to parse certificates and export expiration information for Prometheus to scrape.

WARNING If you run this application in your cluster it will probably require elevated privileges of some kind. Additionally you are exposing VERY sensitive information to it. Review the source!

Usage

cert-exporter can publish metrics about

  • x509 certificates on disk encoded in the PEM format and PKCS12 format
  • Certs embedded or referenced from kubeconfig files.
  • Certs stored in Kubernetes
    • secrets
      • direct support for cert-manager
      • support for password-protected certificates
    • configmaps
    • admission webhooks
    • cert-manager CertificateRequest
  • Certs stored in AWS Secrets manager

See deployment for detailed information on running cert-exporter and examples of running it in a kops cluster.

See custom-secrets for examples of how to run cert-exporter to scrape certificates in secrets managed by you (not cert-manager).

To enable and scrape certificates from AWS secrets, do the following:

go run main.go --aws-account= --aws-region= --aws-secret= [--aws-secret=]

Of course, AWS credentials must be configured. See https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html

Helm

helm repo add cert-exporter https://joe-elliott.github.io/cert-exporter/
helm repo update
helm upgrade --install cert-exporter cert-exporter/cert-exporter

Dashboard

After running cert-exporter in your cluster it's easy to build a custom dashboard to expose information about the certs in your cluster.

Exported Metrics

cert-exporter exports the following metrics

…

cert_exporter_discovered The number of files matched by include/exclude globs across all file-based checkers (certificate files and kubeconfig files). Concurrent checkers accumulate into this gauge rather than overwriting it.

cert_exporter_error_total
The total number of unexpected errors encountered by cert-exporter. A good metric to watch to feel comfortable certs are being exported properly.

--include-serial-label (optional)
Default false (no series identity change). When true, every certificate metric gains a serial label (lowercase hex). Enable this when a single file/secret/configmap key holds multiple PEMs that share the same cn/issuer, otherwise Prometheus collapses them into one series. Enabling this will cause churn, so check your dashboards and alerts beforehand.

Example with the flag on:

cert_exporter_secret_expires_in_seconds{cn="service-ca",issuer="service-ca",key_name="service-ca.crt",secret_name="…",secret_namespace="…",serial="a1b2c3"} …
cert_exporter_secret_expires_in_seconds{cn="service-ca",issuer="service-ca",key_name="service-ca.crt",secret_name="…",secret_namespace="…",serial="d4e5f6"} …

cert_exporter_cert_expires_in_seconds
The number of seconds until a certificate stored in the PEM format is expired. The filename, issuer, cn, and nodename labels indicate the exported cert (serial when enabled).

cert_exporter_kubeconfig_expires_in_seconds
The number of seconds until a certificate stored in a kubeconfig expires. The filename, type, name, and nodename labels indicate the kubeconfig, cluster or user node and name of the node (serial when enabled). See details here.

cert_exporter_secret_expires_in_seconds The number of seconds until a certificate stored in a kubernetes secret expires. The key_name, issuer, cn, secret_name, and secret_namespace labels indicate the secret key, name and namespace (serial when enabled).

cert_exporter_certrequest_expires_in_seconds The number of seconds until a certificate stored in a cert-manager CertificateRequest expires. The cert_request, issuer, cn, and certrequest_namespace labels indicate the CertificateRequest, common name and namespace (serial when enabled).

cert_exporter_certrequest_not_after_timestamp The timestamp when a certificate stored in a cert-manager CertificateRequest expires. The cert_request, issuer, cn, and certrequest_namespace labels indicate the CertificateRequest, common name and namespace (serial when enabled).

cert_exporter_certrequest_not_before_timestamp The timestamp when a certificate stored in a cert-manager CertificateRequest becomes valid. The cert_request, issuer, cn, and certrequest_namespace labels indicate the CertificateRequest, common name and namespace (serial when enabled).

Other Docs

  • Testing
    • An overview of the testing scripts and how to run them. It requires kind CLI.
  • Deployment
    • Information on how to deploy cert-exporter as well as examples for a kops cluster.
  • Daemonset for Prometheus-operator
    • How to deploy daemonset+service+servicemonitor+dashboard if you use prometheus-operator into the monitoring namespace

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言