Skip to content

Commit 99d1484

Browse files
committed
Disable controller-runtime metrics server in bpfman-agent
The bpfman-agent uses hostNetwork: true and the controller-runtime was attempting to bind its default metrics server to port 8080 on the host. This caused port conflicts when other services were already using port 8080 on specific nodes, resulting in 'address already in use' errors. This issue was intermittent and node-specific - some nodes would start the daemon successfully while others would fail, depending on whether something else was already bound to port 8080 on that particular node. Since the metrics decoupling work in PR 443, metrics are now served exclusively via the metrics-proxy DaemonSet, which communicates with the agent through a Unix socket at /var/run/bpfman-agent/metrics.sock. The controller-runtime metrics server on port 8080 is no longer needed. Fix by setting Metrics.BindAddress to '0' to disable the controller-runtime metrics server entirely, eliminating the host port binding conflict. Metrics collection continues to work through the metrics-proxy. [1] #443 Signed-off-by: Andrew McDermott <[email protected]>
1 parent a2e0bdc commit 99d1484

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/bpfman-agent/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import (
4646
"sigs.k8s.io/controller-runtime/pkg/healthz"
4747
"sigs.k8s.io/controller-runtime/pkg/log/zap"
4848
"sigs.k8s.io/controller-runtime/pkg/metrics"
49+
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
4950

5051
"github.com/prometheus/client_golang/prometheus/promhttp"
5152
//+kubebuilder:scaffold:imports
@@ -349,7 +350,11 @@ func main() {
349350
Scheme: scheme,
350351
PprofBindAddress: pprofAddr,
351352
HealthProbeBindAddress: probeAddr,
352-
LeaderElection: false,
353+
Metrics: metricsserver.Options{
354+
// Disable controller-runtime metrics server.
355+
BindAddress: "0",
356+
},
357+
LeaderElection: false,
353358
// Specify that Secrets's should not be cached.
354359
Client: client.Options{
355360
Cache: &client.CacheOptions{

0 commit comments

Comments
 (0)