File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,13 @@ func (cm *controllerManager) Start(stop <-chan struct{}) error {
204
204
// join the passed-in stop channel as an upstream feeding into cm.internalStopper
205
205
defer close (cm .internalStopper )
206
206
207
+ // Metrics should be served whether the controller is leader or not.
208
+ // (If we don't serve metrics for non-leaders, prometheus will still scrape
209
+ // the pod but will get a connection refused)
210
+ if cm .metricsListener != nil {
211
+ go cm .serveMetrics (cm .internalStop )
212
+ }
213
+
207
214
if cm .resourceLock != nil {
208
215
err := cm .startLeaderElection ()
209
216
if err != nil {
@@ -237,11 +244,6 @@ func (cm *controllerManager) start() {
237
244
}
238
245
}()
239
246
240
- // Start the metrics server
241
- if cm .metricsListener != nil {
242
- go cm .serveMetrics (cm .internalStop )
243
- }
244
-
245
247
// Wait for the caches to sync.
246
248
// TODO(community): Check the return value and write a test
247
249
cm .cache .WaitForCacheSync (cm .internalStop )
You can’t perform that action at this time.
0 commit comments