Kuberntes/Prometheus - Unable to Annotate in service file Kuberntes/Prometheus - Unable to Annotate in service file kubernetes kubernetes

Kuberntes/Prometheus - Unable to Annotate in service file


If you annotate the service, it doesn't take any effect on the possibly matched pods. Your pods are managed either by a ReplicationController, or over a ReplicaSet / Deployment. In that case, annotate these resources to make the annotations reach the pods. In example of deployments, you must use the template section, like:

apiVersion: extensions/v1beta1kind: Deploymentmetadata:  # Unique key of the Deployment instance  name: deployment-examplespec:  # 3 Pods should exist at all times.  replicas: 3  # Keep record of 2 revisions for rollback  revisionHistoryLimit: 2  template:    metadata:      annotations:        prometheus.io/scrape: 'true'        prometheus.io/path: /websocket/metrics        prometheus.io/port: '8080'