Getting pod or deployment annotations from Kube-State-Metrics

10/30/2018

My Deployment and Pods have specific annotations:

Deployment Annotations:

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

Pod Annotations:

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

I cannot create labels for these because labels have a size limit of 63 characters and they do not allow special characters like ",". (https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set)

I have a kube-state-metrics pod which scrapes all the metrics from kube-api. However, in kube-state-metrics/metrics, I do not see the deployment.owners or pod.owners annotations anywhere. I see kube_namespace_annotations metric, but I do not see any annotations related to deployments or pods.

Are annotations information not captured by kube-state-metrics? How do I get those info?

-- BlueChips23
kubernetes

1 Answer

10/30/2018

Annotation information are not collected by kube-state-metrics. You can check their documentation to see which metrics are collected for the resources. Here, are link for documentation about Deployment and Pod metrics,

  1. Deployment Metrics
  2. Pod Metrics
-- Emruz Hossain
Source: StackOverflow