<p>Prometheus supports multiple roles in its <a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config" rel="nofollow noreferrer">Kubernetes SD config</a></p>
<p>I'm confused about whether I should use a <a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config" rel="nofollow noreferrer">Pod</a> config or a <a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config" rel="nofollow noreferrer">endpoints</a> role for my Deployment + Service.</p>
<p>The service I am monitoring is a Deployment</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
spec:
 replicas: ~10
 strategy:
    rollingUpdate:
      maxSurge: 5
      maxUnavailable: 0
    type: RollingUpdate
 template:
  containers: 
  - name: web-app
    ports: 
    - containerPort: 3182
      name: http
    - containerPort: 6060
      name: metrics
</code></pre>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: web-app
spec:
  ports:
  - name: http
    port: 3182
    targetPort: http
  selector:
    app: web-app
  type: ClusterIP
</code></pre>
<p>The number of pods can vary in the deployment. The deployment is continuously being updated with new images.</p>
<p>I can add annotations or labels as needed to either of these YAML files.</p>
<p>Is there a reason to prefer either a <strong>Pod</strong> role or an <strong>Endpoints</strong> role?</p>

daxmc99
<p>In short, there are two major differences:</p>
<ul>
<li>an <code>endpoints</code> role gives you more data in labels (to which service a pod belongs, for example);</li>
<li>a <code>pod</code> role targets <strong><em>any</em></strong> pod out there and not just those belonging to a service.</li>
</ul>
<p>What's best for you is for you to decide, but I suppose that an <code>endpoints</code> role would fit well for your production applications (all these usually have a corresponding service), and a <code>pod</code> role for everything else. Or you may do with just one <code>pod</code> role job  for everything and bring that extra information with the <a href="https://github.com/kubernetes/kube-state-metrics" rel="nofollow noreferrer">kube-state-metrics</a> exporter.</p>
