Intelligent Anomaly Detection in Kubernetes Clusters Through Transformer-Based Sequence Modeling
Abstract
To address the challenges of high-dimensionality, rapid state evolution, complex anomaly patterns, and long-term temporal dependencies in Kubernetes cluster runtime environments, a Transformer- based anomaly detection method for Kubernetes clusters is proposed. This method uses multivariate time series generated during cluster operation as the modeling object. First, monitoring metrics from different sources are uniformly organized and temporally aligned, transforming the original runtime state into a continuous sample representation suitable for deep sequence modeling. Then, heterogeneous monitoring features are projected onto a unified latent space through linear mapping, and positional encoding is used to preserve temporal order information, enabling the model to perceive the dynamic evolutionary features during anomaly formation. Building upon this, a multi-head self-attention mechanism is introduced to model the global dependencies between different variables at different times, enhancing the ability to express complex contextual relationships and potential anomaly precursors. Furthermore, a feedforward network and hierarchical encoding structure are combined to refine the temporal semantics layer by layer, resulting in a more stable and discriminative global state representation. Finally, sequence-level representation is used to complete anomaly identification, effectively distinguishing between normal and abnormal states of the Kubernetes cluster. The proposed method is well adapted to the characteristics of cloud-native environments, such as multi-component linkage, complex anomaly propagation paths, and the interplay of local fluctuations and global instability. It has strong applicability in anomaly feature mining, temporal correlation modeling, and overall state discrimination, and can provide effective support for intelligent monitoring and anomaly identification of Kubernetes clusters.