<p>My Pod is not appearing in the prometheus targets</p>
<p>the application is exposing metrics '/metrics'</p>
<p>I added a service monitor to expose the service</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: abc 
  # Change this to the namespace the Prometheus instance is running in
  # namespace: default
  labels:
    app: abc
    release: prometheus
spec:
  selector:
    matchLabels:
      app: abc # target gitlab service
  endpoints:
    - port: http
      interval: 15s
      path: /metrics
</code></pre>
<p>but still prometheus can't read the metrics</p>

<p>make sure that your pod has a label called &quot;app&quot;</p>
<pre><code>Labels:       app=&lt;appname&gt;
</code></pre>
<p>if you are using helpm chart add the label in the helper  in {{chart-name}}\templates_helpers.tpl</p>
<pre class="lang-yaml prettyprint-override"><code>{{/*
Selector labels
*/}}
{{- define &quot;&lt;appname&gt;.selectorLabels&quot; -}}
app.kubernetes.io/name: {{ include &quot;&lt;appname&gt;.name&quot; . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app: {{ .Release.Name }} # &lt;======================================= add this 
{{- end }}
</code></pre>
<p>replace &quot;&lt; appname &gt;&quot; with your app name</p>
<p>check if your pod appeared in http://localhost:9090/config</p>
<pre class="lang-yaml prettyprint-override"><code>rule_files:
- /etc/prometheus/rules/prometheus-prometheus-kube-prometheus-prometheus-rulefiles-0/*.yaml
scrape_configs:
- job_name: default/&lt;appname&gt;y/0
  honor_timestamps: true
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  relabel_configs:
  - source_labels: [__meta_kubernetes_service_label_app]
    separator: ;
    regex: 
    replacement: $1
    action: keep
  - source_labels: [__meta_kubernetes_endpoint_port_name]
    separator: ;
    regex: http
    replacement: $1
    action: keep
</code></pre>
