Migrating stateful microservices in Kubernetes requires careful state management because in-memory state is lost when a container restarts. For StatefulSet-managed workloads, the problem is compounded by identity constraints that prohibit two pods with the same ordinal from running simultaneously, forcing a sequential stop-recreate cycle with a median 38.5s of service downtime. This paper presents SHADOW Seamless Handoff And Zero-Downtime Orchestrated Workload Migration, a Kubernetes-native framework that implements the Message-based Stateful Microservice Migration (MS2M) approach as a Kubernetes Operator. SHADOW introduces the ShadowPod strategy, where a shadow pod is created from a CRIU checkpoint image on the target node while the source pod continues serving traffic, allowing concurrent operation during message replay. For StatefulSet workloads, an identity swap procedure with the ExchangeFence mechanism re-checkpoints the shadow pod, creates a StatefulSet-owned replacement, and drains both message queues to guarantee zero message loss during the handoff. An evaluation on a bare-metal Kubernetes cluster with 280 migration runs across four configurations and seven message rates (10--120msg/s) shows that, compared to the sequential baseline on the same StatefulSet workload, the ShadowPod strategy reduces the restore phase by up to 92%, eliminates service downtime entirely, and reduces total migration time by up to 77%, with zero message loss across all 280 runs.
翻译:在Kubernetes中迁移有状态微服务需要精细的状态管理,因为容器重启时会丢失内存状态。对于StatefulSet管理的工作负载,身份约束(禁止具有相同序数的两个Pod同时运行)加剧了该问题,迫使执行顺序的停止-重建循环,导致服务停机时间中位数为38.5秒。本文提出SHADOW(Seamless Handoff And Zero-Downtime Orchestrated Workload Migration),一种Kubernetes原生框架,它将基于消息的有状态微服务迁移(MS2M)方法实现为Kubernetes Operator。SHADOW引入ShadowPod策略:在目标节点上从CRIU检查点镜像创建影子Pod,同时源Pod继续处理流量,允许在消息重放期间并发运行。对于StatefulSet工作负载,通过ExchangeFence机制的身份交换过程对影子Pod执行重新检查点、创建StatefulSet拥有的替换Pod,并排空两个消息队列,保证切换期间零消息丢失。在裸机Kubernetes集群上进行的评估(涵盖四种配置、七种消息速率(10-120消息/秒)、共280次迁移运行)表明:与相同StatefulSet工作负载上的顺序基线相比,ShadowPod策略将恢复阶段缩短最多92%,完全消除服务停机,并将总迁移时间减少最多77%,所有280次运行均实现零消息丢失。