<p>I am trying to follow <a href="https://burhan.io/flask-application-monitoring-with-prometheus/" rel="nofollow noreferrer">https://burhan.io/flask-application-monitoring-with-prometheus/</a> and make my pods discovered by Prometheus but I am not having any luck.  Could someone see what I am doing wrong or debug it?</p>

<p>First to make sure my app is configured right...I configured it directly and saw the metrics in Prometheus.</p>

<pre><code>- job_name: 'myapp'
        scheme: http
        static_configs:
        - targets: ['172.17.0.7:9090']
</code></pre>

<p>Next, I tried to do the discovery. This is how the deployment looks</p>

<pre><code>kind: Deployment
metadata:
  name: myapp
  labels:
    app: myapp 
spec:
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: myapp:latest
        ports:
        - containerPort: 9090
...
</code></pre>

<p>and this is the prometheus config</p>

<pre><code>  - job_name: 'kubernetes-pods'
        scheme: http
        metrics_path: /metrics
        kubernetes_sd_configs:
        - role: node
        relabel_configs:
        - source_labels: [__meta_kubernetes_pod_label_app]
          regex: myapp
          action: keep
</code></pre>

<p>but I don't see any metrics in Prometheus or any mention of <code>myapp</code> in Prometheus debug log. What am I missing?</p>

<p>I see that you didn't define <code>- api_server: 'https://kubernetes'</code>. Make sure you define api-server in <code>kubernetes_sd_config</code>. Prometheus auto discovers services via api-server.</p>

<ul>
<li>Please refer my <a href="https://stackoverflow.com/questions/47682158/prometheus-auto-discovery-k8s">previous question</a> </li>
<li>Sample configuration in my    repo <a href="https://github.com/veerendra2/prometheus-k8s-monitoring/blob/master/prometheus-configmap.yml" rel="nofollow noreferrer">here</a></li>
<li>Prometheus <code>kubernetes_sd_config</code> docs here</li>
</ul>
