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

KubeVirt Virtual Machine Live Migration Stall Sentinel

Audits KubeVirt operator metrics to detect VM live migration convergence stalls, dirty memory page saturation, and network drops.

Categories
CloudInfrastructure

Automates continuous health and convergence surveillance for KubeVirt virtual machine live migration controllers across Kubernetes nodes.

How it works

  1. A schedule trigger executes the KubeVirt live migration audit workflow every 15 minutes.
  2. The Python task queries the KubeVirt operator Prometheus metrics endpoint on port 8443.
  3. The script extracts un-migrated dirty memory page sizes, cross-node migration throughput rates, and migration failure counts.
  4. An evaluation gate determines whether dirty page convergence stalls, throughput collapses, or failure events breach limits.
  5. When live migration degradation is detected, a high-priority Slack incident alert is dispatched to Virtualization SREs.
  6. When virtual machines live migrate seamlessly across physical hypervisor hosts, nominal telemetry is logged.
  7. A structured JSON audit manifest is emitted for bare-metal virtualization governance and workload relocation archives.

Architecture diagram

graph TD
    Trigger[Schedule Trigger: 15m] --> ScanMetrics[Python Script: Scrape KubeVirt Metrics]
    ScanMetrics --> EvalBreach{Remaining MB > Limit OR Failures > 1 OR Rate < 5MB/s?}
    EvalBreach -- Yes --> SlackAlert[Slack: High-Urgency Virt Alert]
    EvalBreach -- No --> LogNominal[Log: Nominal KubeVirt State]
    SlackAlert --> EmitManifest[Debug Return: Virt Audit Manifest]
    LogNominal --> EmitManifest

Architecture components

  • Trigger: Automated schedule polling at 15-minute recurring intervals.
  • Script Task: Scrapes KubeVirt operator Prometheus metrics endpoints using Docker container runners.
  • Decision Gate: Evaluates whether un-migrated memory pages or cross-hypervisor throughput breach limits.
  • Notification Task: Dispatches structured Slack alerts with VM name and migration convergence metrics.
  • Audit Manifest: Emits JSON execution payloads containing virtualization migration health and timestamps.

Key capabilities

  • Continuous surveillance of VirtualMachineInstanceMigration CRDs, libvirt QEMU processes, and node migration channels.
  • Early warning detection for write-heavy database VMs whose dirty memory generation outpaces network migration capacity.
  • Automated tracking of cross-node network throughput collapse caused by MTU mismatch or switch saturation.
  • Zero host dependency execution via isolated containerized Python runners.

What you get

  • Real-time visibility into Kubernetes bare-metal virtual machine live migration progress and convergence health.
  • Proactive alerts preventing node maintenance drain timeouts and aborted workload evacuations.
  • Standardized audit manifests containing exact transfer rates, failure totals, and execution timestamps.
  • Zero-overhead deployment compatible with Multus secondary networks and dedicated migration interfaces.

Who it's for

  • Virtualization and platform engineers managing containerized and virtual machine workloads on Kubernetes.
  • Cloud infrastructure leads modernizing enterprise VMware/OpenStack estates onto KubeVirt bare metal.
  • Site Reliability Engineers orchestrating zero-downtime node rolling maintenance across hypervisor pools.
  • High-performance database administrators running latency-sensitive stateful VMs in cloud-native environments.

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 virtualization platform surveillance as versioned code in Git repositories.
  • Comprehensive Audit History: Preserves historical migration performance metrics in searchable Kestra execution logs.

Use cases

  • Node Evacuation Drain Guard: Ensures virtual machines migrate off physical hosts before automated OS kernel patching begins.
  • Database Dirty Page Stall Alarm: Detects when write-heavy Oracle or SQL Server VMs fail iterative migration rounds.
  • Dedicated Migration Network Degradation: Identifies throughput bottlenecks on secondary 25GbE/100GbE migration VLANs.

Inputs

Name Type Default Description
kubevirt_metrics_url STRING http://kubevirt-operator.kubevirt.svc.cluster.local:8443 Internal HTTP URL exposing Prometheus metrics for KubeVirt.
vm_identifier STRING oracle-db-workload-vm Identifier of the target VirtualMachineInstance monitored.
max_dirty_memory_remaining_mb INT 2048 Maximum allowable un-migrated dirty memory before alerting.
max_migration_failures_threshold INT 1 Maximum allowable live migration abort or timeout failures.
alert_on_throughput_drop BOOL true Toggle whether migration throughput below 5 MB/s triggers an alert.

Expected outputs

  • {{ outputs.scan_kubevirt_telemetry.vars.data_remaining_mb }}: Volume of un-migrated dirty memory pages in megabytes.
  • {{ outputs.scan_kubevirt_telemetry.vars.migration_rate_mb_per_sec }}: Observed cross-node migration transfer rate in MB/s.
  • {{ outputs.scan_kubevirt_telemetry.vars.migration_failures_total }}: Total count of failed live migration attempts.
  • {{ outputs.scan_kubevirt_telemetry.vars.is_alerting }}: Boolean flag indicating if migration health bounds are breached.
  • {{ outputs.scan_kubevirt_telemetry.vars.audit_timestamp }}: ISO-8601 UTC timestamp of the KubeVirt audit run.

Prerequisites

  • KubeVirt virtualization operator installed with Prometheus metrics enabled on port 8443.
  • Network connectivity from the Kestra worker to the KubeVirt metrics service endpoint.
  • Configured Slack incoming webhook URL with permissions to post in virtualization alert channels.

Secrets

  • SLACK_WEBHOOK_URL: Secure webhook URL for routing virtualization alerts to the Platform Slack channel.

Quick start

  1. Verify that KubeVirt operator exposes Prometheus metrics on HTTP port 8443.
  2. Add the SLACK_WEBHOOK_URL secret within your Kestra namespace settings.
  3. Specify your virtual machine identifier in vm_identifier.
  4. Run a manual flow execution via the Kestra UI to validate metric ingestion.
  5. Enable the periodic_kubevirt_audit schedule trigger to establish automated monitoring.

Common pitfalls and troubleshooting

  • CPU Model Incompatibility: Live migration fails instantly if source and destination nodes feature mismatched CPU models.
  • Shared Storage Locking: Persistent volumes must support ReadWriteMany (RWX) or live migration will be rejected by admission.
  • Bandwidth Throttling Limits: Check migrationConfiguration.bandwidthPerMigration in KubeVirt CR to avoid network starvation.
  • AutoConverge Activation: Ensure allowAutoConverge: true is configured to throttle vCPU when dirty page rates are excessive.

How to extend

  • Automated Workload Throttling: Trigger CPU cgroup throttling on write-heavy VMs if migration exceeds 10 minutes.
  • PagerDuty Escalation: Escalate to on-call infrastructure engineers if node evacuation stalls during a planned maintenance window.
  • Cluster-Wide Migration Sweep: Expand script parameters to monitor all active VirtualMachineInstanceMigrations concurrently.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.