An audit method and device based on cloud native resource tracking and a storage medium

By transforming Kubernetes resource changes into a distributed tracing chain in a cloud-native platform and combining it with audit data, the problems of low efficiency in resource fault location and insufficient security auditing in cloud-native environments are solved, enabling full-chain correlation retrieval and rapid fault location.

CN123137952APending Publication Date: 2026-11-20HANGZHOU WOQU NETWORK TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611645764.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-23
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In cloud-native platforms, existing technologies struggle to achieve end-to-end correlation retrieval, resulting in low efficiency in resource fault location and insufficient security auditing capabilities. This is especially true in database cloud platforms and multi-tenant Kubernetes environments, where resource relationships are fragmented, event lifecycles are short, auditing perspectives are disjointed, and problem location costs are high.

Method used

By transforming Kubernetes resource changes into a distributed tracing chain and combining it with audit data, a full-chain correlation retrieval from user operations to resource changes is achieved. Resource change events are stored in a distributed repository to generate causal tracing chains, and a list of audit events is received to form a full-chain audit evidence chain.

Benefits of technology

It improves the efficiency of fault location and security auditing capabilities in cloud-native environments, realizes end-to-end correlation retrieval, reduces collection overhead, ensures the integrity and timeliness of audit data, and supports rapid location of which stage a container group is stuck at.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137952A_ABST
    Figure CN123137952A_ABST
Patent Text Reader

Abstract

The present application relates to the cloud native monitoring technical field, especially to a kind of based on cloud native resource tracking audit method, equipment and storage medium, the method includes: the resource information of k8s cluster is acquired in real time, target resource is filtered and listens to, resource change event is encapsulated and written into distributed storage library, the unique identifier and version number of resource object are extracted to generate tracking identifier and span identifier, establish parent-child resource causality based on owner reference, form distributed tracking link, listen to the life cycle event of container group, generate each stage tracking span and as child span are mounted to corresponding tracking link, receive audit event list pushed by audit network hook, distributed tracking link, stage tracking span and the resource change class operation request extracted are stored in the same distributed storage library according to uniform indexing strategy, to form full-link audit evidence chain;The present application can improve fault location efficiency and security audit capability under cloud native environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of cloud-native monitoring technology, and in particular to an auditing method, device and storage medium based on cloud-native resource tracking. Background Technology

[0002] In cloud-native platforms, business objects are typically composed of a large number of Kubernetes resources, including deployments, stateful replica sets, replica sets, container groups, services, configuration dictionaries, keys, and persistent volume declarations. Kubernetes resources are abbreviated as k8s resources. A single business deployment, scaling up or down, fault recovery, or failure retries will generate a large number of resource changes, events, and audit logs across different controllers, schedulers, node agents, and application interface servers.

[0003] Current operations and maintenance personnel often need to switch back and forth between event lists, resource definitions, interface audit logs, application logs, and monitoring metrics, making it difficult to quickly answer questions such as "Who triggered the change, which resources did the change propagate to, why is a certain container group not ready for a long time, and whether an operation was unauthorized or abnormal?" This problem is particularly evident in database cloud platforms, complex state services, and multi-tenant Kubernetes environments, mainly manifested in the following ways: First, resource relationships are scattered. Kubernetes resource objects depend on owner references and establish parent-child relationships, but regular logs only record individual objects, making it difficult to form cross-resource causal chains. Second, event lifecycles are short. Kubernetes events are prone to expiration or aggregation, making it difficult to trace the key time consumption of each stage of the container group's lifecycle in the long term. Third, audit perspectives are fragmented. Application interface server-side audits record user requests, while resource listeners record object changes; the two lack a unified index and association method. Fourth, problem localization is costly. A single abnormal release may involve multiple types of resources, multiple resource version changes, and multiple controllers, requiring manual investigation to piece together a large number of timelines.

[0004] Therefore, there is an urgent need for an auditing method that can achieve end-to-end correlation retrieval and improve the efficiency of resource fault location and security auditing capabilities in cloud-native environments. Summary of the Invention

[0005] To address the aforementioned technical issues, this invention provides an auditing method, device, and storage medium based on cloud-native resource tracing. By transforming Kubernetes resource changes into a distributed tracing link and combining it with audit data, it enables end-to-end correlation retrieval from user operations to resource changes, thereby improving fault location efficiency and security auditing capabilities in a cloud-native environment.

[0006] According to a first aspect of the present invention, an auditing method based on cloud-native resource tracing is provided, comprising the following steps:

[0007] It can obtain resource information corresponding to the application interface server in the Kubernetes cluster in the cloud-native environment in real time, filter target resources according to the preset filtering policy, and start listening to continuously generate resource change events.

[0008] The resource change event is encapsulated into a data item and written to a distributed repository; the data item includes the timestamp of the resource change event, the event type, and the corresponding resource object.

[0009] For the resource object, the unique identifier and version number carried by the resource object are extracted to generate a tracking identifier and a span identifier. Based on the owner reference of the read resource object, a causal relationship between parent and child resources is established to transform the resource change event into a distributed tracking link with hierarchical causal relationship.

[0010] Based on the distributed tracing link, the system listens to the lifecycle events of container groups in the Kubernetes cluster and drives the finite state machine to drive the state transition of the container group according to the lifecycle events. It generates stage tracing spans that represent different lifecycles of the container group and attaches the stage tracing spans as sub-spans to the tracing link indicated by the tracing identifier corresponding to the container group.

[0011] The system receives the list of audit events pushed by the application interface server of the Kubernetes cluster through the audit network hook, and stores the distributed tracing link, the stage tracing span, and the resource change operation requests extracted from the audit event list into the distributed repository according to a unified indexing strategy to form a full-link audit evidence chain.

[0012] According to a second aspect of the present invention, a non-transitory computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored therein, the at least one instruction or the at least one program being loaded and executed by a processor to implement the above-described auditing method based on cloud-native resource tracing.

[0013] According to a third aspect of the present invention, an electronic device is provided, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0014] The present invention has at least the following beneficial effects:

[0015] This invention provides an auditing method based on cloud-native resource tracing. First, it acquires resource information from the Kubernetes cluster in real time, filters target resources, and monitors them, ensuring audit coverage while excluding low-value, high-frequency resources and reducing collection overhead. Then, it encapsulates monitored resource change events into data items and writes them to a distributed repository, ensuring the integrity of the audit data. Next, it extracts the unique identifier and version number of the resource object to generate a tracking identifier and a span identifier, enabling previously isolated resource change events to be uniformly identified and retrieved within the distributed tracing model. Furthermore, it establishes parent-child resource causal relationships based on owner references, forming a distributed tracing chain with hierarchical causal relationships. This transforms the previously isolated hierarchical derivation relationships between resource objects into an expandable causal chain, facilitating subsequent fault tracing. Source and impact scope analysis provides a structured foundation; then, it monitors the lifecycle events of container groups, generates tracing spans for each stage and attaches them as sub-spans to the corresponding tracing links, ensuring that the tracing processes of multiple container groups do not interfere with each other and facilitating quick location of which stage a container group is stuck in; finally, it receives the audit event list pushed by the audit network hook, and stores the extracted resource change operation requests, distributed tracing links, and stage tracing spans into the same distributed repository according to a unified index. This enables subsequent association retrieval by establishing the relationship between indexes through the unique identifier or audit identifier of the resource object, forming a full-link audit evidence chain. This allows for full-link association retrieval from user operations to resource changes, thereby improving the efficiency of fault location and security auditing capabilities in cloud-native environments. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating the auditing method based on cloud-native resource tracing provided in this embodiment of the invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] This invention provides an auditing method based on cloud-native resource tracing, such as... Figure 1 As shown, the method includes the following steps:

[0020] S1 obtains resource information corresponding to the application interface server in the Kubernetes cluster in the cloud-native environment in real time, filters target resources according to the preset filtering strategy and starts listening to continuously generate resource change events.

[0021] Specifically, the real-time acquisition of resource information corresponding to the application programming interface (API) server in the Kubernetes cluster of the cloud-native environment, filtering target resources according to a preset filtering strategy, and starting monitoring includes:

[0022] S101, periodically call the resource discovery interface provided by the application interface server of the k8s cluster to obtain a list of all resource groups and resource types currently supported by the k8s cluster, and combine them into the resource information.

[0023] Specifically, the application programming interface (API) server refers to the core control component of the Kubernetes cluster, the API Server, which is responsible for receiving and processing all resource operation requests within the Kubernetes cluster, and providing a resource discovery interface. The resource discovery interface is used to query the resource groups and resource types currently supported by the Kubernetes cluster. A resource group is a logical unit for classifying and managing resources in the Kubernetes cluster. For example, the core resource group includes basic resources such as container groups, services, and configuration dictionaries, while the application resource group includes controller resources such as deployments, replica sets, and stateful replica sets. The resource type list records the specific resource types and their version information supported under each resource group. In one embodiment, if listening is interrupted but the version number has not expired, listening continues based on the previously recorded version number; when the version number of the target resource expires, the latest version number is automatically obtained, and listening continues.

[0024] S102, the resource information is filtered according to a preset filtering strategy to obtain at least one target resource; the filtering strategy includes skipping a specified resource group or only monitoring a specified resource group. For example, some resources in a Kubernetes cluster, such as endpoint slices, change very frequently but have low audit value, and are usually filtered out.

[0025] S103: Start full namespace monitoring for the selected target resources to continuously generate resource change events representing the addition, modification, or deletion of the target resources. Each resource change event carries a timestamp of the event occurrence, the event type, and complete data of the changed resource object.

[0026] Specifically, the full namespace monitoring refers to the collector initiating a monitoring request to the application interface server for each target resource, specifying the monitoring scope as the entire namespace within the cluster.

[0027] As described above, by periodically calling the resource discovery interface, the collector can automatically sense the dynamic changes in resource groups and resource types in the cluster, avoiding the omission of custom resources or newly registered resource types due to a fixed resource list. It also filters target resources through filtering strategies, which can exclude low-value, high-frequency resources while ensuring audit coverage and reducing collection overhead.

[0028] S2, the resource change event is encapsulated as a data item and written to the distributed repository. In one embodiment, the distributed repository may use a storage engine such as Elasticsearch that supports distributed indexing and full-text search.

[0029] Specifically, the data items include the timestamp of the resource change event, the event type, and the corresponding resource object. The timestamp provides a time reference for subsequently building the distributed tracing chain and calculating the time consumed at each stage; the event type identifies whether the event is a new event, a modified event, or a deleted event, so that different span identifiers can be generated accordingly; the resource object is the complete data of the changed resource, including metadata such as a unique identifier, version number, and owner reference.

[0030] Specifically, the resource change event is encapsulated as a data item and written to a distributed repository, including:

[0031] S201, the resource change event is encapsulated as a data item and written to a circular queue, and multiple concurrent worker threads extract the data item from the circular queue. The number of concurrent worker threads can be configured according to the computing resources of the node where the collector is located and the cluster size.

[0032] It should be explained that the circular queue is a buffer queue with a fixed depth. When the queue is not full, data items are queued and processed in the order they are written; when the queue is full, write operations are blocked and wait until a worker thread removes a data item from the queue to free up space.

[0033] S202, detect the version information of the distributed repository and select the corresponding storage adapter according to the version information; this can be understood as: the storage adapter is a software module that encapsulates the writing logic of a specific version of the distributed repository, used to shield the interface differences between different versions, so that the collector can write data to the distributed repository of different versions in a unified way.

[0034] S203, based on the selected storage adapter, the extracted data items are written in batches to the distributed repository according to a preset batch commit threshold. Those skilled in the art can set the batch commit threshold according to actual needs.

[0035] As described above, by using a circular queue to smooth out and buffer resource change events, it is possible to effectively cope with a large number of sudden resource changes in the cluster, and avoid the collector from losing events or becoming overloaded due to instantaneous high concurrency. By automatically adapting to different versions of the distributed repository through version detection, and extracting and writing data in batches to the distributed repository in parallel through multiple concurrent worker threads, it improves the throughput efficiency of data ingestion while ensuring storage compatibility, and ensures the integrity and timeliness of audit data.

[0036] S3. For the resource object, extract the unique identifier and version number carried by the resource object, generate a tracking identifier and a span identifier, and establish a causal relationship between parent and child resources based on the owner reference of the read resource object, so as to transform the resource change event into a distributed tracking link with hierarchical causal relationship.

[0037] Specifically, the generation of tracking identifiers and span identifiers includes:

[0038] S301, extract the unique identifier carried by the resource object and convert the unique identifier into a tracing identifier. Since each Kubernetes resource object is assigned a globally unique identifier by the application interface server upon creation, and this unique identifier remains unchanged throughout the entire lifecycle of the resource object, the tracing identifier is used to identify an entire causal chain. That is, starting from a root resource, all resource change events formed through layer-by-layer derivation share the same tracing identifier. Specifically, during the conversion, the connector in the unique identifier can be removed and used directly as the tracing identifier.

[0039] S302, determine the event type of the resource change event. If it is a new event, generate a span identifier using the unique identifier of the resource object; if it is a modification event, generate a span identifier using the version number of the resource object. The span identifier is used to identify a single operation node in the tracing chain, meaning each resource change event corresponds to a span in the tracing chain. If the resource change event is a new event, a span identifier is generated using the unique identifier of the resource object, ensuring that the new event has a unique and stable node identifier in the tracing chain. If the resource change event is a modification event, it indicates that the resource object has undergone a state change based on its existing state. In this case, a span identifier is generated using the version number of the resource object, ensuring that each modification forms an independent span node in the tracing chain, thus completely recording the multiple change history of the resource object.

[0040] S303, write the original data, unique identifier, version number and event type of the resource object together into the corresponding span tag; it can be understood that the original data, unique identifier, version number and event type are attached to the corresponding span tag as attribute information.

[0041] As described above, by converting unique identifiers into tracking identifiers and generating span identifiers by distinguishing event types, unified classification of resource change events and unique identification of spans are achieved. This enables previously isolated resource change events to be uniformly identified and retrieved in the distributed tracking model. By writing the original data and change information of resource objects into span tags, each span node becomes an independently searchable and auditable data unit, which helps to improve auditing capabilities.

[0042] Furthermore, establishing the causal relationship between parent and child resources based on the owner reference of the read resource object includes:

[0043] S310: Read the owner reference of the resource object to determine if the resource object has a parent resource. The owner reference is a metadata field in the Kubernetes cluster's resource object, used to declare which parent resource created and manages the resource object. For example, the owner reference of a container group created by a replica set points to the replica set; the owner reference of a replica set created by a deployment points to the deployment.

[0044] S320, if a parent resource exists, a causal reference relationship between the child resource span and the parent resource span is generated based on the parent resource's tracking identifier and span identifier. This can be understood as: the causal reference relationship is a directional reference, indicating that the change event of the child resource is triggered by the change event of the parent resource, thereby forming a parent-child hierarchical structure on the distributed tracking link.

[0045] S330: If no parent resource exists, the resource change event is attached to the root span corresponding to the resource object itself. This ensures that a complete distributed tracing chain is formed after child resource change events are derived from this root resource.

[0046] As described above, the existence of a parent resource for a resource object is determined by the owner reference, and a causal relationship between parent and child resources is established when a parent resource exists. This transforms the hierarchical derivation relationship between originally isolated resource objects into an expandable causal chain, providing a structured foundation for subsequent fault tracing and impact scope analysis.

[0047] S4, based on the distributed tracing link, listens to the lifecycle events of container groups in the Kubernetes cluster, and drives the finite state machine to drive the state transition of the container group according to the lifecycle events, generates the stage tracing span representing different lifecycles of the container group, and attaches the stage tracing span as a sub-span to the tracing link indicated by the tracing identifier corresponding to the container group; it can be understood that the attachment relationship is reflected in the tracing identifier and causal reference field.

[0048] Specifically, the container group is the smallest deployable computing unit in a Kubernetes cluster, and a container group can contain one or more containers.

[0049] Furthermore, the tracking span representing different lifecycle stages of the container group is generated through the following steps:

[0050] S401, monitor lifecycle events related to container groups in the Kubernetes cluster; these lifecycle events include scheduling events, image pull events, container creation events, and container startup events. Specifically, a scheduling event indicates that the container group has been assigned to a node by the scheduler; an image pull event indicates that the image for a container in the container group is being pulled or has been pulled successfully; a container creation event indicates that a container in the container group has been created; and a container startup event indicates that a container in the container group has started. It should be noted that native Kubernetes cluster lifecycle events are characterized by short lifecycles, easy expiration, and easy aggregation. If not collected in a timely manner, long-term traceability is difficult. Therefore, this embodiment transforms them into a long-term tracing span through subsequent steps. In specific implementations, lifecycle events also carry attributes such as event cause, event message, event source, and associated objects.

[0051] S402, upon capturing the completion of a container creation event, a container group lifecycle tracker is created, and the tracking identifier corresponding to the container group is registered to the container group lifecycle tracker. By creating an independent lifecycle tracker for each container group and registering the tracking identifier, it is ensured that the lifecycle tracking processes of multiple container groups do not interfere with each other, and that the tracking span of each stage can be accurately attached to the corresponding tracking link.

[0052] S403, the container group lifecycle tracker continuously monitors the lifecycle events and drives the finite state machine to control the state transition of the container group according to the lifecycle events, sequentially entering the scheduling phase, initialization phase and startup phase; it can be understood that: the finite state machine defines several states in the lifecycle of the container group and the transition conditions between states, and the container group lifecycle tracker uses each monitored lifecycle event as the trigger condition for state transition, driving the finite state machine to control the state transition of the container group sequentially.

[0053] S404, the container group lifecycle tracker generates stage tracking spans for the scheduling phase, initialization phase, and startup phase, and calculates the duration of each phase to locate anomalies in the container group at each phase. This can be understood as: a stage tracking span is a span node used to characterize the start and end times of a certain phase. When the finite state machine enters each phase, the container group lifecycle tracker creates a stage tracking span for that phase and records the start time of that phase; when the state machine leaves that phase and enters the next phase, it records the end time of that phase, thereby calculating the duration of that phase.

[0054] The above describes how a finite state machine aggregates the originally discrete and easily expired container group lifecycle events into an ordered stage tracking span, enabling quantifiable traceability of the time consumed in each stage of scheduling, initialization, and startup. Furthermore, by attaching the stage tracking span to the distributed tracking link, it ensures that the tracking processes of multiple container groups do not interfere with each other, and facilitates quick location of which stage a container group is stuck in.

[0055] S5. The system receives the audit event list pushed by the Kubernetes cluster's application interface server via the audit network hook. It then stores the distributed tracing link, stage tracing span, and resource change operation requests extracted from the audit event list into the distributed repository according to a unified indexing strategy, forming a full-link audit evidence chain. The audit network hook is an audit log push mechanism provided by the Kubernetes cluster's application interface server. When processing user requests, the application interface server generates audit events according to a preset audit strategy and actively pushes these audit events to an external receiver in the form of an event list via the audit network hook. These audit events record user operation requests to resources in the Kubernetes cluster, including operator identity, request verb, request object, request time, and request source address. By receiving the audit event list pushed by the audit network hook, the collector can obtain first-hand records of all user operations in the cluster, providing a data source for subsequently constructing a full-link audit evidence chain from user operations to resource changes.

[0056] Specifically, storing the distributed tracing chain, the stage tracing span, and resource change operation requests extracted from the audit event list into the distributed repository according to a unified index includes:

[0057] S501, the audit event list is deserialized, and read-only requests are filtered out, retaining resource change operation requests. The audit event list pushed by the application programming interface (API) server is in a serialized data format; deserialization restores it to a processable audit event object. The audit event object contains a request verb field to identify the type of operation initiated by the user on the resource. Request verbs can be divided into two categories: read-only requests and change operation requests.

[0058] It should be noted that read-only requests include fetch, listen, and list requests. These requests only query the resource status without changing the resource content, and their audit value is low. If all of them are retained, they will consume a lot of storage resources and dilute the effective audit information, so they need to be filtered out. Change operation requests include create, update, and delete requests. These requests will actually change the resource status in the cluster and have high audit value.

[0059] S502, generate a date index based on the timestamps carried by each audit event in the audit event list, and write the resource change operation request into the audit index indicated by the date index. For example, write all resource change operation requests generated on the same day into the audit index named after that date.

[0060] S503, the audit index and the distributed tracing link and stage tracing span are stored in the same distributed repository according to a unified indexing strategy to support associated retrieval based on the unique identifier or audit identifier of the resource object.

[0061] Specifically, the unified indexing strategy refers to establishing indexes for audit data, tracking link data, and stage tracking span data respectively, and establishing the association between the indexes through the unique identifier or audit identifier of the resource object, so that although the three types of data are stored in different indexes, they can be retrieved through a unified query interface.

[0062] As described above, by receiving the audit event list, the source of user operations and the result of resource changes are incorporated into the same data system, which makes up for the shortcomings of the separation between operation logs and resource status in traditional solutions. Through a unified indexing strategy, audit data and tracing links are associated and stored in the same distributed repository. User operations and resource change results are compared and associated based on the unique identifier or audit identifier of the resource object, realizing the full-link association retrieval from user operations to resource changes, and providing a complete chain of evidence for security auditing and fault determination.

[0063] In one embodiment, the method further includes the following steps:

[0064] S10 listens to the application interface via the HTTP protocol to provide an interface for querying the running status. This running status query interface is the self-check and observation entry point provided by the data collector. Through this interface, maintenance personnel can remotely obtain the real-time running status of the data collector without logging into the node where the data collector is located.

[0065] S20, in response to the call to the running status query interface, output and display the current depth of the circular queue, the version number of the target resource, the cached parent-child resource causal relationships, and the storage status of the distributed repository. It should be noted that the depth of the circular queue reflects the backlog of data items to be processed. If the queue depth remains high, it indicates insufficient processing capacity of the collector or obstruction of downstream storage writes. The version number of the target resource reflects the resource version recorded by the collector when monitoring each target resource, and can be used to determine whether monitoring is progressing normally. The cached parent-child resource causal relationships reflect the hierarchical relationships of resource objects currently established by the collector, and can be used to verify whether the tracing link modeling is normal. The storage status of the distributed repository reflects the connection status between the collector and the repository and whether writes are normal.

[0066] S30, continuously outputs runtime logs; these logs include resource monitoring status, version number change records, circular queue depth change records, and batch write-to-distributed repository commit results, used for fault location and collector health monitoring. The batch write-to-distributed repository commit results reflect whether each batch commit was successful and the amount of data committed.

[0067] As mentioned above, by providing operational status query services and outputting key operational logs, operations and maintenance personnel can monitor the operational status of each link in real time, such as the backlog of circular queues, resource version advancement, tracing link modeling, and storage writing, thereby quickly locating faults and ensuring the long-term stable operation of the collector.

[0068] Embodiments of the present invention also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method in the method embodiments, wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiments.

[0069] Embodiments of the present invention also provide an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0070] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. It should also be understood that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.

Claims

1. An auditing method based on cloud-native resource tracing, characterized in that, The method includes the following steps: It can obtain resource information corresponding to the application interface server in the Kubernetes cluster in the cloud-native environment in real time, filter target resources according to the preset filtering strategy and start listening to continuously generate resource change events. The resource change event is encapsulated into a data item and written to a distributed repository; the data item includes the timestamp of the resource change event, the event type, and the corresponding resource object. For the resource object, the unique identifier and version number carried by the resource object are extracted, a tracking identifier and a span identifier are generated, and a causal relationship between parent and child resources is established based on the owner reference of the read resource object, so as to transform the resource change event into a distributed tracking link with hierarchical causal relationship. Based on the distributed tracing link, the lifecycle events of container groups in the Kubernetes cluster are monitored, and the finite state machine is driven to drive the state transition of the container group according to the lifecycle events. The stage tracing span representing different lifecycles of the container group is generated, and the stage tracing span is attached as a sub-span to the tracing link indicated by the tracing identifier corresponding to the container group. The system receives the list of audit events pushed by the application interface server of the Kubernetes cluster through the audit network hook, and stores the distributed tracing link, the stage tracing span, and the resource change operation requests extracted from the audit event list into the distributed repository according to a unified indexing strategy to form a full-link audit evidence chain.

2. The auditing method based on cloud-native resource tracing according to claim 1, characterized in that, The process of acquiring resource information corresponding to the application interface server in the Kubernetes cluster in the cloud-native environment in real time, filtering target resources according to a preset filtering strategy, and starting monitoring includes: Periodically call the resource discovery interface provided by the application interface server of the Kubernetes cluster to obtain a list of all resource groups and resource types currently supported by the Kubernetes cluster, and combine them into the resource information. The resource information is filtered according to a preset filtering strategy to obtain at least one target resource; the filtering strategy includes skipping a specified resource group or only monitoring a specified resource group. Start full namespace listening for the selected target resources to continuously generate resource change events that represent the addition, modification or deletion of the target resources.

3. The auditing method based on cloud-native resource tracing according to claim 1, characterized in that, Encapsulating the resource change event into a data item and writing it to a distributed repository includes: The resource change event is encapsulated as a data item and written into a circular queue, and the data item is extracted from the circular queue by multiple concurrent worker threads; Detect the version information of the distributed repository and select the corresponding storage adapter based on the version information; Based on the selected storage adapter, the extracted data items are written to the distributed repository in batches according to a preset batch submission threshold.

4. The auditing method based on cloud-native resource tracing according to claim 1, characterized in that, The generation of tracking identifiers and span identifiers includes: Extract the unique identifier carried by the resource object and convert the unique identifier into a tracking identifier; Determine the event type of the resource change event. If it is a new event, generate a span identifier using the unique identifier of the resource object; if it is a modification event, generate a span identifier using the version number of the resource object. Write the resource object's original data, unique identifier, version number, and event type together into the corresponding span tag.

5. The auditing method based on cloud-native resource tracing according to claim 1, characterized in that, The establishment of a causal relationship between parent and child resources based on the owner reference of the read resource object includes: Read the owner reference of the resource object to determine if the resource object has a parent resource; If a parent resource exists, a causal reference relationship between the child resource span and the parent resource span is generated based on the parent resource's tracking identifier and span identifier. If no parent resource exists, the resource change event is attached to the root span corresponding to the resource object itself.

6. The auditing method based on cloud-native resource tracing according to claim 1, characterized in that, The following steps are used to generate the tracking span that represents different lifecycle stages of the container group: Monitor lifecycle events related to container groups in the Kubernetes cluster; these lifecycle events include scheduling events, image pull events, container creation events, and container startup events. When a container creation event is captured as complete, a container group lifecycle tracker is created, and the tracking identifier corresponding to the container group is registered to the container group lifecycle tracker. The container group lifecycle tracker continuously monitors the lifecycle events and drives the finite state machine to control the state transition of the container group according to the lifecycle events, sequentially entering the scheduling phase, initialization phase and startup phase; The container group lifecycle tracker generates stage tracking spans for the scheduling stage, initialization stage, and startup stage, and calculates the time consumed in each stage to locate anomalies in the container group at each stage.

7. The auditing method based on cloud-native resource tracing according to claim 1, characterized in that, The step of storing the distributed tracing chain, the stage tracing span, and resource change operation requests extracted from the audit event list into the distributed repository according to a unified index includes: The audit event list is deserialized, and read-only requests are filtered out, while resource change operation requests are retained; Generate a date index based on the timestamps carried by each audit event in the audit event list, and write the resource change operation request into the audit index indicated by the date index; The audit index, the distributed tracing link, and the stage tracing span are stored in the same distributed repository according to a unified indexing strategy to support associated retrieval based on the unique identifier or audit identifier of the resource object.

8. The auditing method based on cloud-native resource tracing according to claim 3, characterized in that, The method further includes the following steps: Listen to the application interface via the HTTP protocol to provide an interface for querying runtime status; In response to a call to the runtime status query interface, the current depth of the circular queue, the version number of the target resource, the causal relationship of cached parent and child resources, and the storage status of the distributed repository are output and displayed. Continuously output operation logs; the operation logs include resource monitoring status, version number change records, circular queue depth change records, and batch write to the distributed repository commit results, which are used for fault location and collector health monitoring.

9. A non-transitory computer-readable storage medium, wherein the storage medium stores at least one instruction or at least one program segment, characterized in that, The at least one instruction or the at least one program segment is loaded and executed by the processor to implement the auditing method based on cloud-native resource tracing as described in any one of claims 1-8.

10. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium as described in claim 9.