Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

MetalLB BGP Speaker Peer Flap and Eviction Sentinel

Audits MetalLB bare-metal load balancer telemetry to detect BGP peering session flaps, speaker pod evictions, and route announcement stalls.

Categories
CloudInfrastructure

Automates continuous health and routing stability surveillance for MetalLB BGP speaker deployments in bare-metal Kubernetes.

How it works

  1. A schedule trigger executes the MetalLB network routing audit workflow every 15 minutes.
  2. The Python task queries the MetalLB speaker metrics service endpoint on port 7472.
  3. The script extracts BGP peering session state transitions, speaker pod evictions, and announced IP route counts.
  4. An evaluation gate determines whether session flaps, pod evictions, or peer disconnections breach operational bounds.
  5. When BGP routing instability is detected, a high-priority Slack alert is dispatched to the Network SRE team.
  6. When speakers maintain established peering sessions with top-of-rack switches, nominal telemetry is logged.
  7. A structured JSON audit manifest is emitted for network governance and bare-metal service SLA records.

Architecture diagram

graph TD
    Trigger[Schedule Trigger: 15m] --> ScanMetrics[Python Script: Scrape MetalLB Metrics]
    ScanMetrics --> EvalBreach{Session Flaps > 3 OR BGP Peer Down?}
    EvalBreach -- Yes --> SlackAlert[Slack: High-Urgency Network Alert]
    EvalBreach -- No --> LogNominal[Log: Nominal MetalLB State]
    SlackAlert --> EmitManifest[Debug Return: Network Audit Manifest]
    LogNominal --> EmitManifest

Architecture components

  • Trigger: Automated schedule polling at 15-minute recurring intervals.
  • Script Task: Scrapes MetalLB speaker Prometheus metrics endpoints using Docker container runners.
  • Decision Gate: Evaluates whether BGP session flaps or speaker pod evictions exceed configured limits.
  • Notification Task: Dispatches structured Slack alerts with BGP router ASN and session state metrics.
  • Audit Manifest: Emits JSON execution payloads containing bare-metal network health and timestamps.

Key capabilities

  • Continuous surveillance of BGP peering sessions between MetalLB speaker pods and datacenter switches.
  • Early warning detection for BGP flapping caused by hold-timer expirations or asymmetric link saturation.
  • Automated tracking of speaker daemonset eviction events during Kubernetes node memory pressure.
  • Zero host dependency execution via isolated containerized Python runners.

What you get

  • Real-time visibility into bare-metal Kubernetes ingress traffic ingress and external IP reachability.
  • Proactive alerts preventing load balancer VIP packet loss caused by withdrawn BGP routes.
  • Standardized audit manifests containing exact announced route totals and execution timestamps.
  • Zero-overhead deployment compatible with FRRouting and Native BGP implementation modes in MetalLB.

Who it's for

  • Network SREs and datacenter infrastructure engineers maintaining bare-metal Kubernetes clusters.
  • Systems administrators managing BGP peering with Cisco, Arista, and Juniper top-of-rack switches.
  • Cloud platform architects designing on-premises Kubernetes edge and hybrid cloud networks.
  • Enterprise reliability engineers ensuring high-availability ingress for critical on-prem services.

Why orchestrate this with Kestra

  • Serverless Docker Isolation: Executes telemetry scraping in ephemeral Docker environments without persistent workers.
  • Centralized Secrets Governance: Protects sensitive Slack webhooks using encrypted namespace secrets.
  • Declarative YAML Workflows: Manages network control plane surveillance as versioned code in Git repositories.
  • Comprehensive Audit History: Preserves historical BGP peering telemetry in searchable Kestra execution logs.

Use cases

  • BGP Flap Dampening Protection: Prevents upstream datacenter routers from suppressing flapping service VIPs.
  • Node Eviction Remediation: Identifies when kubelet eviction terminates speaker pods on edge worker nodes.
  • Route Capacity Monitoring: Verifies that new LoadBalancer Services correctly propagate routes to leaf switches.

Inputs

Name Type Default Description
metallb_metrics_url STRING http://metallb-speaker-monitor.metallb-system.svc.cluster.local:7472 Internal HTTP URL exposing Prometheus metrics for MetalLB.
bgp_router_asn INT 64512 Autonomous system number of the upstream BGP router.
max_peer_session_flaps_threshold INT 3 Maximum allowable BGP session flaps within the evaluation window.
max_speaker_evictions_threshold INT 1 Maximum allowable evicted MetalLB speaker pods.
alert_on_bgp_peer_down BOOL true Toggle whether BGP session down state triggers an alert.

Expected outputs

  • {{ outputs.scan_metallb_telemetry.vars.peer_flaps_count }}: Count of BGP session state transition flaps.
  • {{ outputs.scan_metallb_telemetry.vars.speaker_evictions_count }}: Count of evicted MetalLB speaker daemonset pods.
  • {{ outputs.scan_metallb_telemetry.vars.bgp_session_up_flag }}: Health status indicator of the BGP peering session.
  • {{ outputs.scan_metallb_telemetry.vars.is_alerting }}: Boolean flag indicating if network SLA is breached.
  • {{ outputs.scan_metallb_telemetry.vars.audit_timestamp }}: ISO-8601 UTC timestamp of the network audit run.

Prerequisites

  • MetalLB 0.13+ deployed in BGP mode with Prometheus metrics enabled on port 7472.
  • Network connectivity from the Kestra worker to the MetalLB speaker metrics service.
  • Configured Slack incoming webhook URL with permissions to post in network alert channels.

Secrets

  • SLACK_WEBHOOK_URL: Secure webhook URL for routing network alerts to the Network SRE Slack channel.

Quick start

  1. Verify that MetalLB speaker daemonset exposes Prometheus metrics on HTTP port 7472.
  2. Add the SLACK_WEBHOOK_URL secret within your Kestra namespace settings.
  3. Specify your upstream router ASN in bgp_router_asn.
  4. Run a manual flow execution via the Kestra UI to validate metric ingestion.
  5. Enable the periodic_metallb_audit schedule trigger to establish automated monitoring.

Common pitfalls and troubleshooting

  • BFD Timer Mismatches: Aggressive BFD timers between speaker pods and switches can cause spurious session drops.
  • Firewall Filtering: Ensure TCP port 179 is open bi-directionally between worker nodes and BGP peers.
  • Node HostNetwork Permissions: Speaker pods require hostNetwork: true to bind directly to node IP interfaces.
  • Password Authentication: Verify MD5 password configurations match upstream BGP peer declarations.

How to extend

  • Automated Speaker Restart: Trigger a daemonset rollout restart if a speaker pod enters an unrecoverable state.
  • PagerDuty Escalation: Escalate to on-call network engineers if all BGP sessions report down simultaneously.
  • Multi-Peer Expansion: Extend metric queries to aggregate health across multiple redundant upstream leaf switches.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.