|
141 | 141 | target_label: 'namespace',
|
142 | 142 | },
|
143 | 143 |
|
144 |
| - // Rename instances to be the pod name |
| 144 | + // Rename instances to the concatenation of pod:container:port. |
| 145 | + // All three components are needed to guarantee a unique instance label. |
145 | 146 | {
|
146 |
| - source_labels: ['__meta_kubernetes_pod_name'], |
| 147 | + source_labels: [ |
| 148 | + '__meta_kubernetes_pod_name', |
| 149 | + '__meta_kubernetes_pod_container_name', |
| 150 | + '__meta_kubernetes_pod_container_port_name', |
| 151 | + ], |
147 | 152 | action: 'replace',
|
| 153 | + separator: ':', |
148 | 154 | target_label: 'instance',
|
149 | 155 | },
|
150 | 156 |
|
|
192 | 198 | action: 'keep',
|
193 | 199 | },
|
194 | 200 |
|
195 |
| - // Rename instances to be the pod name. |
196 |
| - // As the scrape two ports of KSM, include the port name in the instance |
197 |
| - // name. Otherwise alerts about scrape failures and timeouts won't work. |
| 201 | + // Rename instances to the concatenation of pod:container:port. |
| 202 | + // In the specific case of KSM, we could leave out the container |
| 203 | + // name and still have a unique instance label, but we leave it |
| 204 | + // in here for consistency with the normal pod scraping. |
198 | 205 | {
|
199 |
| - source_labels: ['__meta_kubernetes_pod_name', '__meta_kubernetes_pod_container_port_name'], |
| 206 | + source_labels: [ |
| 207 | + '__meta_kubernetes_pod_name', |
| 208 | + '__meta_kubernetes_pod_container_name', |
| 209 | + '__meta_kubernetes_pod_container_port_name', |
| 210 | + ], |
200 | 211 | action: 'replace',
|
201 | 212 | separator: ':',
|
202 | 213 | target_label: 'instance',
|
|
0 commit comments