Skip to content

Commit 19e0904

Browse files
authored
fix(cockpit): k8s-monitoring autodiscovery annotations placement. ext-fix-cockpit (#5626)
1 parent 6861ae0 commit 19e0904

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pages/cockpit/how-to/send-metrics-from-k8s-to-cockpit.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,20 @@ alloy-singleton:
7070
7171
## Add annotations for auto-discovery
7272
73-
Annotations in Kubernetes provide a way to attach metadata to your resources. For `k8s-monitoring`, these annotations signal which Pods should be scraped for metrics, and what port to use. In this documentation we are adding annotations to specify we want `k8s-monitoring` to scrape the Pods from our deployment. Make sure that you replace `$METRICS_PORT` with the port where your application exposes Prometheus metrics.
73+
Annotations in Kubernetes provide a way to attach metadata to your resources. For `k8s-monitoring`, these annotations signal which Pods should be scraped for metrics, and what port to use. These annotations have to be on the Pods that the deployement will spawn so they have to be in the Pod template, not the deployement itself.
74+
In this documentation we are adding annotations to specify we want `k8s-monitoring` to scrape the Pods from our deployment. Make sure that you replace `$METRICS_PORT` with the port where your application exposes Prometheus metrics.
7475

7576
### Kubernetes deployment template
7677

7778
```yaml
7879
apiVersion: apps/v1
7980
kind: Deployment
80-
metadata:
81-
...
82-
annotations:
83-
"k8s.grafana.com/metrics.portNumber" = "$METRICS_PORT"
84-
"k8s.grafana.com/scrape" = "true"
8581
spec:
86-
...
82+
template:
83+
metadata:
84+
annotations:
85+
"k8s.grafana.com/metrics.portNumber" = "$METRICS_PORT"
86+
"k8s.grafana.com/scrape" = "true"
8787
```
8888

8989
### Terraform/OpenTofu deployment template
@@ -173,4 +173,4 @@ Now that your metrics are exported to your Cockpit, you can access and query the
173173
6. In the **Labels filter** drop-down, select the `cluster` label and in the **Value** drop-down, select your cluster.
174174
7. Optionally, click the **Clock** icon on the top right corner of your screen and filter by time range.
175175
8. Click **Run query** to see your metrics. An output similar to the following should display.
176-
<Lightbox image={image} alt="" />
176+
<Lightbox image={image} alt="" />

0 commit comments

Comments
 (0)