【问题标题】:Getting pod or deployment annotations from Kube-State-Metrics从 Kube-State-Metrics 获取 pod 或部署注解
【发布时间】:2018-10-30 23:56:13
【问题描述】:

我的 Deployment 和 Pod 有特定的注解:

部署注释:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.owners: 'owner1@example.org,owner2@example.org,owner3@example.org'

 

Pod 注释:

metadata:
      annotations:
        pod.owners: 'owner1@example.org,owner2@example.org,owner3@example.org'

我无法为这些创建标签,因为标签的大小限制为 63 个字符,并且不允许使用“,”等特殊字符。 (https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set)

我有一个 kube-state-metrics pod,它从 kube-api 抓取所有指标。但是,在 kube-state-metrics/metrics 中,我在任何地方都看不到 deployment.ownerspod.owners 注释。我看到了 kube_namespace_annotations 指标,但我没有看到任何与部署或 pod 相关的注释。

kube-state-metrics 是否没有捕获到注解信息?我如何获得这些信息?

【问题讨论】:

    标签: kubernetes


    【解决方案1】:

    kube-state-metrics 不收集注释信息。您可以查看他们的文档以查看为资源收集了哪些指标。这里是有关 DeploymentPod 指标的文档链接,

    1. Deployment Metrics
    2. Pod Metrics

    【讨论】:

    • 谢谢。不包括注释有点令人沮丧。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-05
    • 1970-01-01
    • 1970-01-01
    • 2021-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多