A method and device for constructing a range environment for cloud-native chaos engineering experiments
By copying the Kubernetes resources and traffic of the production environment in the cloud-native environment and building a shooting range environment, the problem that cloud-native chaos engineering experiments are difficult to perform in the production environment is solved, and efficient experimental simulation and testing results are improved.
Patent Information
- Application Number
- CN202210666363.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-14
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-06-14
AI Technical Summary
When performing chaos engineering experiments in cloud native scenarios, it is difficult to conduct experiments in production environments, resulting in poor testing results and the real production environment cannot be fully simulated.
By obtaining the resource information and actual call traffic of the container cloud Kubernetes cluster in the actual production environment, copying it to the shooting range environment and traffic that is consistent with the production environment, thereby realizing the simulation of the production environment.
Complete simulation of the production environment is achieved, the testing effect of chaos engineering experiments is improved, and the confidence and external effectiveness of experimental results are ensured.
Smart Images

Figure CN114996955B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud native technology, and in particular to a method and device for constructing a target range environment for a cloud native chaos engineering experiment. Background Art
[0002] Chaos engineering is a discipline that conducts experiments on distributed systems, with the goal of building confidence in the system's ability to resist out-of-control conditions in the production environment. Cloud native is a distributed cloud based on distributed deployment and unified operation and management, and a set of cloud technology product systems built on technologies such as containers, microservices, and DevOps.
[0003] In traditional software testing, the main focus is on verifying the correctness of code logic, but this is not enough. When conducting chaos engineering experiments in cloud-native scenarios, people are usually interested in the behavior of the entire system as a whole. Code is only an important part of the entire system. In addition to code, the entire system also includes many other aspects, especially state, input, and unpredictable system behavior caused by third-party systems.
[0004] Conducting experiments in a production environment is crucial for chaos engineering. To build confidence in the system in a production environment, experiments need to be conducted in a production environment. Otherwise, simply building confidence in the system in a traditional test environment will greatly weaken the value of these practices. Even if experiments cannot be conducted in a production environment, they should be conducted in an environment as close to the production environment as possible. The closer to the production environment, the fewer threats to the external validity of the experiment, and the greater the confidence in the experimental results. Because chaos engineering testing itself is risky, it is usually not implemented in a production environment. Instead, chaos engineering testing is performed using testing and quasi-production environments. However, due to configuration differences from the real production environment and the inability to access real traffic, the real production environment cannot be fully simulated, and the ability of chaos engineering testing cannot be fully utilized to achieve comprehensive testing results. Summary of the invention
[0005] In response to the above problems, the present invention provides a method and device for constructing a target range environment for a cloud-native chaos engineering experiment, which realizes the simulation of the production environment and improves the test effect of the chaos engineering experiment.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A method for constructing a range environment for a cloud-native chaos engineering experiment, comprising:
[0008] Obtain resource information of the Container Cloud Kubernetes cluster in the actual production environment;
[0009] Copy the resource information to the Kubernetes cluster of the range environment to implement the range environment construction;
[0010] Obtaining actual call traffic in the actual production environment;
[0011] Forwarding the actual call traffic to the shooting range environment to realize the construction of the shooting range environment traffic;
[0012] In response to completing the construction of the range environment and the range environment flow, a target range environment is obtained.
[0013] Optionally, obtaining resource information of a container cloud Kubernetes cluster in an actual production environment includes:
[0014] Determine the resource scope of the container cloud Kubernetes cluster in the actual production environment;
[0015] Based on the target interface, resource information of the container cloud Kubernetes cluster in the actual production environment within the resource range is obtained, and the target interface is an application program interface based on the container cloud Kubernetes.
[0016] Optionally, copying the resource information to a Kubernetes cluster of a range environment includes:
[0017] Acquire the arrangement file corresponding to the resource information, and store the arrangement file in a target location;
[0018] In response to copying the orchestration file at the target location to the Kubernetes cluster of the range environment, controlling the Kubernetes cluster to create a target object corresponding to the orchestration file;
[0019] In response to starting a persistent container node on a working node in the range environment, reading a mount directory of persistent storage data of a business persistent container node in the production environment through the persistent container node;
[0020] The mount directory is copied to the range environment to implement copying of persistent storage data to the range environment.
[0021] Optionally, forwarding the actual call traffic to a range environment includes:
[0022] Determine traffic forwarding configuration information, where the traffic forwarding configuration information is used to add a container for traffic forwarding in a container in an actual production environment;
[0023] The traffic of the actual production environment is intercepted through the traffic forwarding configuration information, and the intercepted actual call traffic is sent to the business container of the actual production environment, and the actual call traffic is forwarded to the target range environment.
[0024] Optionally, it also includes:
[0025] Obtain task information carrying the target chaos experiment task;
[0026] determining fault injection information based on the task information;
[0027] The fault injection information is injected into a target range environment.
[0028] Optionally, the method further comprises:
[0029] In response to completing the injected fault test based on the target range environment, the target range environment is restored to obtain a restored range environment.
[0030] A device for constructing a range environment for a cloud-native chaos engineering experiment, comprising:
[0031] The first acquisition unit is used to acquire resource information of the container cloud Kubernetes cluster in the actual production environment;
[0032] A replication unit, used to replicate the resource information to the Kubernetes cluster of the range environment to implement the range environment construction;
[0033] A second acquisition unit is used to acquire actual call traffic in the actual production environment;
[0034] A forwarding unit, used for forwarding the actual call traffic to the shooting range environment to realize the construction of the shooting range environment traffic;
[0035] The target acquisition unit is used to obtain a target range environment in response to completing the construction of the range environment and the range environment flow.
[0036] Optionally, the first acquiring unit is specifically configured to:
[0037] Determine the resource scope of the container cloud Kubernetes cluster in the actual production environment;
[0038] Based on the target interface, resource information of the container cloud Kubernetes cluster in the actual production environment within the resource range is obtained, and the target interface is an application program interface based on the container cloud Kubernetes;
[0039] Wherein, the replication unit is specifically used for:
[0040] Acquire the arrangement file corresponding to the resource information, and store the arrangement file in a target location;
[0041] In response to copying the orchestration file at the target location to the Kubernetes cluster of the range environment, controlling the Kubernetes cluster to create a target object corresponding to the orchestration file;
[0042] In response to starting a persistent container node on a working node in the range environment, reading a mount directory of persistent storage data of a business persistent container node in the production environment through the persistent container node;
[0043] The mount directory is copied to the range environment to implement copying of persistent storage data to the range environment.
[0044] Optionally, the forwarding unit is specifically configured to:
[0045] Determine traffic forwarding configuration information, where the traffic forwarding configuration information is used to add a container for traffic forwarding in a container in an actual production environment;
[0046] The traffic of the actual production environment is intercepted through the traffic forwarding configuration information, and the intercepted actual call traffic is sent to the business container of the actual production environment, and the actual call traffic is forwarded to the target range environment.
[0047] Optionally, it also includes:
[0048] The third acquisition unit is used to acquire task information carrying the target chaos experiment task;
[0049] A determination unit, configured to determine fault injection information based on the task information;
[0050] A fault injection unit, used to inject the fault injection information into a target range environment;
[0051] The recovery unit is used to recover the target range environment in response to completing the injected fault test based on the target range environment to obtain a recovered range environment.
[0052] Compared with the prior art, the present invention provides a method and device for constructing a target range environment for a cloud-native chaos engineering experiment, including: obtaining resource information of a container cloud Kubernetes cluster in an actual production environment; copying the resource information to the Kubernetes cluster of the target range environment to realize target range environment construction; obtaining actual call traffic in the actual production environment; forwarding the actual call traffic to the target range environment to realize the construction of the target range environment traffic; in response to completing the construction of the target range environment and the target range environment traffic, obtaining the target range environment. The present invention realizes the replication of the basic environment based on cloud-native backup and recovery technology, and replicates the production traffic to the target range environment based on traffic replication technology, thereby fully simulating the production environment and achieving the best effect of chaos engineering testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0054] Figure 1 A schematic diagram of a flow chart of a method for constructing a target range environment for a cloud-native chaos engineering experiment provided in an embodiment of the present invention;
[0055] Figure 2 A schematic diagram of a shooting range environment construction scene provided by an embodiment of the present invention;
[0056] Figure 3 A schematic diagram of a shooting range environment structure and application provided by an embodiment of the present invention;
[0057] Figure 4 A schematic diagram of the structure of a target range environment construction device for a cloud-native chaos engineering experiment provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] The terms "first" and "second" and the like in the specification and claims of the present invention and the above drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0060] In an embodiment of the present invention, a method for constructing a target range environment for a cloud-native chaos engineering experiment is provided. The method realizes the replication of a basic environment based on cloud-native backup and recovery technologies, and replicates production traffic to a target range environment based on traffic replication technology, thereby fully simulating a production environment and achieving the best effect of chaos engineering testing.
[0061] Among them, the target range environment is a technology that simulates the real environment based on virtualization technology. For example, the technology or product that simulates and reproduces the operating status and operating environment of the network architecture, system equipment, and business processes in the real cyberspace, so as to more effectively realize network security-related learning, research, testing, competition, exercises and other behaviors, thereby improving the network security confrontation level of personnel and institutions.
[0062] The embodiment of the present invention is implemented based on the Kubernetes (Container Cloud) platform. Kubernetes (k8s for short) is an open source container operating platform that can realize functions such as combining several containers into a service and dynamically allocating hosts for container operation, providing great convenience for users to use containers.
[0063] See also Figure 1 , which is a flow chart of a method for constructing a target range environment for a cloud native chaos engineering experiment provided by an embodiment of the present invention. The method may include the following steps:
[0064] S101. Obtain resource information of the container cloud Kubernetes cluster in the actual production environment.
[0065] In the embodiment of the present invention, a range environment must first be constructed, that is, an environment that is completely consistent with the actual production environment must be constructed to facilitate subsequent chaotic fault injection testing in the range environment.
[0066] The object of the chaos engineering experiment on cloud native is Kubernetes resources, that is, the resource information of the container cloud Kubernetes cluster in the actual production environment mainly includes the Kubernetes cluster physical node Node used to run containers, the workload used to orchestrate the container operation mode, such as Pod, Deployment, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob, etc., the load balancer service Service used to define the container, the persistent storage PV used to continuously save business data, the ConfigMap for container configuration, Secret and other custom CRD resources.
[0067] In one implementation of an embodiment of the present invention, obtaining resource information of a container cloud Kubernetes cluster in an actual production environment includes: determining a resource scope for obtaining a container cloud Kubernetes cluster in an actual production environment; and obtaining resource information of a container cloud Kubernetes cluster in an actual production environment within the resource scope based on a target interface, wherein the target interface is an application program interface based on container cloud Kubernetes.
[0068] Specifically, the target interface can be the Kubernetes Restful API (Container Cloud Application Programming Interface), which is used to obtain the chaos exercise resources of the Kubernetes cluster in the production environment, such as workloads and persistent storage PVs; the obtained data is copied to the Kubernetes cluster in the target environment, and the copied data is written to the Kubernetes cluster in the target environment through the Kubernetes API, so as to migrate the chaos exercise resources in the production environment to the target environment, thereby building a target environment for chaos testing that is completely consistent with the production environment.
[0069] When obtaining resource information, you must first specify the scope of the ubernetes resources to be obtained, which can be any resource in Kubernetes, such as one or more Pod, ConfigMap, Secret resources. You can directly specify the resource name, or select it by label. For services in Kubernetes, resources of the same service contain the same label. For example, service A, which includes multiple resources such as Pod and PVC, are all set with the label App = A. When specifying the scope, specify all resources of App = A for overall acquisition.
[0070] S102: Copy the resource information to the Kubernetes cluster of the range environment to implement the range environment construction.
[0071] In one embodiment, copying the resource information to the Kubernetes cluster of the range environment includes: obtaining an orchestration file corresponding to the resource information, and storing the orchestration file at a target location; in response to copying the orchestration file at the target location to the Kubernetes cluster of the range environment, controlling the Kubernetes cluster to create a target object corresponding to the orchestration file; in response to starting a persistent container node on a working node in the range environment, reading a mount directory of persistent storage data of a business persistent container node in a production environment through the persistent container node; and copying the mount directory to the range environment to implement copying of persistent storage data to the range environment.
[0072] Specifically, after obtaining the resource scope, the relevant resources and data can be copied, and the copying is implemented in the Kubernetes API. The resource copying method for Kubernetes is: for the specified resource, call the Kubernetes API to obtain the orchestration file of the resource, and save it to the local or other object storage. The data saved in the local or object storage is transferred to the range environment by file copying, and the copied orchestration file is written to the Kubernetes cluster of the range environment by calling the Kubernetes API. After writing, Kubernetes will create the corresponding object.
[0073] Pod is the smallest deployment unit in Kubernetes. Pod is composed of one or more containers. Usually Pod will store PV data, and PV is a persistent storage volume. PV data can be understood as a standard resource on k8s. In the present invention, for the convenience of description, PV data is referred to as persistent storage data, and Pod is referred to as a persistent container node. Specifically, for the persistent storage PV data mounted by Pod, it is also necessary to copy the PV data through the underlying storage, support file-level replication, and ensure data consistency. The specific method is to start a DaemonSet Pod on each working node of Kubernetes. The Pod reads the PV mount directory on the node where the business Pod is located, and backs up the files in the mount directory to the local or object storage. The backup process supports incremental backup. After the backup is completed, the backed up data is copied to the target range environment, a new PV is applied for in the target range environment, and the data of the backed up PV is copied to the newly applied PV to achieve continuous PV data replication.
[0074] S103: Acquire actual call traffic in the actual production environment.
[0075] S104: forwarding the actual call traffic to the shooting range environment to realize the construction of the shooting range environment traffic.
[0076] After the target range environment is built, the target range environment traffic is built. The purpose of the target range traffic construction is to inject the real call traffic in the actual production environment into the target range environment by forwarding, so as to achieve a state in which the production environment is completely simulated in the target range environment.
[0077] The present invention adopts the traffic forwarding technology based on the Kubernetes Pod layer. Kubernetes Pod uses the sidecar method to add a traffic forwarding Sidecar container to the Pod that needs to be forwarded. By configuring the Kubernetes service, the traffic of the production environment is first forwarded to the Sidecar container. According to the forwarding policy configuration of the Sidecar container, the Sidecar container then sends the traffic to the production business container and the business container of the range environment respectively.
[0078] In one implementation of an embodiment of the present invention, forwarding the actual call traffic to a target range environment includes: determining traffic forwarding configuration information, wherein the traffic forwarding configuration information is used to add a container for traffic forwarding in a container of an actual production environment; intercepting the traffic of the actual production environment through the traffic forwarding configuration information, and sending the intercepted actual call traffic to a business container of the actual production environment, while forwarding the actual call traffic to the target range environment.
[0079] Specifically, the corresponding forwarding range, destination address and other information can be determined through the traffic forwarding configuration information. For example, for Pod-level traffic forwarding, you first need to add configuration to the traffic to be forwarded in the production environment and add a Kubernetes ConfigMap to the cluster. The ConfigMap defines the traffic forwarding strategy, including the forwarding percentage, forwarding target address, etc.
[0080] After configuring the policy through traffic forwarding configuration information, configure the business Pod to be forwarded in the production environment, add a Sidecar container to the business Pod, which intercepts all traffic entering the Pod, sends the traffic to the actual business container, and forwards the traffic to the target address according to the configured forwarding policy, thereby realizing production traffic construction. After the configuration is completed, the traffic forwarding of the Pod is enabled one by one through rolling upgrades.
[0081] S105. In response to completing the construction of the shooting range environment and the shooting range environment flow, obtaining a target shooting range environment.
[0082] By replicating the container resources in the actual production environment and forwarding the call traffic, the construction of the target range environment and the target range environment traffic is completed, that is, the target range environment that matches the actual production environment is obtained, and chaos engineering experiments can be implemented in this target range environment later.
[0083] See also Figure 2 , which is a schematic diagram of a target range environment construction scenario provided by an embodiment of the present invention. The production environment includes multiple clusters, such as cluster 1 and cluster 2, each cluster includes multiple business containers, such as pod-1-1, pod-1-2, pod-1-3, and pod-2-1, pod-2-2, pod-2-3, and then these container resources are copied to the corresponding containers in the target range environment, and the request traffic in the production environment is forwarded to the target range environment, so as to build a target range environment consistent with the production environment.
[0084] After the target range environment is constructed, a chaos engineering experiment can be implemented in the target range environment. In an embodiment of the present invention, the method further includes: obtaining task information carrying the target chaos experiment task; determining fault injection information based on the task information; and injecting the fault injection information into the target range environment.
[0085] Among them, task information can refer to the test task information of the target chaos experiment task, and fault injection information can include fault injection type, fault injection method, specific fault information, etc. After the target range environment and production traffic are built, chaos engineering experiments can be implemented in the target range environment. Fault injection refers to the use of the idea of chaos engineering to conduct fault drills in the target range environment, such as injecting high CPU and memory load on the working node, and network delay of the Pod. Faults are injected into the business Pod and the various resources it depends on, such as working nodes, clusters, etc., to verify the stability of the business system.
[0086] The embodiments of the present invention do not limit the fault injection method, and there are many ways to inject faults, such as implementing fault injection through the open source tool chaosblade, or implementing it through some chaos engineering platforms. Fault types include node restart downtime, node CPU, memory high load, Pod memory high load, Pod restart, Pod network abnormality and other common or self-developed faults.
[0087] During the fault injection process, it is necessary to observe various monitoring indicators in real time, including indicators of basic resources, platforms, and businesses, and judge the stability of the system and business by the changes in indicators. For example, after the fault injection, whether the TPS of the business decreases or the error rate increases.
[0088] Correspondingly, in the embodiment of the present invention, it also includes: in response to completing the injected fault test based on the target range environment, restoring the target range environment to obtain a restored range environment.
[0089] After the fault injection test is completed, the target environment can be restored. This includes restoring the injected fault, stopping traffic forwarding in the production environment, and dismantling the built target environment. Fault recovery includes canceling the fault injected into the system, such as terminating the process that causes high CPU load on the node, and restoring the CPU usage of the node to the state before the fault injection. Traffic recovery is to delete the Sidecar container responsible for traffic forwarding in the production environment, and delete the ConfigMap that defines the traffic forwarding policy.
[0090] See also Figure 3 , which is a schematic diagram of a range environment construction and application provided in an embodiment of the present invention, wherein the overall process mainly includes: range environment construction, traffic construction, fault injection and environment recovery. Specifically, the environment construction mainly includes specifying the resource range, k8s resource replication and PV data replication. The traffic construction process includes: starting traffic forwarding, configuring traffic forwarding, configuring the target pod and forwarding taking effect. The fault injection process includes starting to inject faults, fault injection, and monitoring and observation. The environment recovery process includes: starting environment recovery, fault recovery, traffic recovery, and environment removal. Among them, the specific processing process involved please refer to the description in the aforementioned embodiment of the present invention, which will not be described in detail here.
[0091] In an embodiment of the present invention, a device for constructing a range environment for a cloud-native chaos engineering experiment is also provided. Figure 4 ,include:
[0092] The first acquisition unit 201 is used to acquire resource information of the container cloud Kubernetes cluster in the actual production environment;
[0093] A copy unit 202 is used to copy the resource information to the Kubernetes cluster of the range environment to implement the range environment construction;
[0094] The second acquisition unit 203 is used to acquire the actual call traffic in the actual production environment;
[0095] The forwarding unit 204 is used to forward the actual call traffic to the shooting range environment to realize the construction of the shooting range environment traffic;
[0096] The target acquisition unit 205 is used to obtain a target range environment in response to completing the construction of the range environment and the range environment flow.
[0097] In one implementation, the first acquisition unit is specifically configured to:
[0098] Determine the resource scope of the container cloud Kubernetes cluster in the actual production environment;
[0099] Based on the target interface, resource information of the container cloud Kubernetes cluster in the actual production environment within the resource range is obtained, and the target interface is an application program interface based on the container cloud Kubernetes;
[0100] Wherein, the replication unit is specifically used for:
[0101] Acquire the arrangement file corresponding to the resource information, and store the arrangement file in a target location;
[0102] In response to copying the orchestration file at the target location to the Kubernetes cluster of the range environment, controlling the Kubernetes cluster to create a target object corresponding to the orchestration file;
[0103] In response to starting a persistent container node on a working node in the range environment, reading a mount directory of persistent storage data of a business persistent container node in the production environment through the persistent container node;
[0104] The mount directory is copied to the range environment to implement copying of persistent storage data to the range environment.
[0105] In another implementation, the forwarding unit is specifically configured to:
[0106] Determine traffic forwarding configuration information, where the traffic forwarding configuration information is used to add a container for traffic forwarding in a container in an actual production environment;
[0107] The traffic of the actual production environment is intercepted through the traffic forwarding configuration information, and the intercepted actual call traffic is sent to the business container of the actual production environment, and the actual call traffic is forwarded to the target range environment.
[0108] In one embodiment, the device further comprises:
[0109] The third acquisition unit is used to acquire task information carrying the target chaos experiment task;
[0110] A determination unit, configured to determine fault injection information based on the task information;
[0111] A fault injection unit, used to inject the fault injection information into a target range environment;
[0112] The recovery unit is used to recover the target range environment in response to completing the injected fault test based on the target range environment to obtain a recovered range environment.
[0113] Based on the aforementioned embodiments, an embodiment of the present application provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps of any of the node selection methods above.
[0114] An embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the steps of the node selection method are implemented when the processor executes the program.
[0115] The present invention provides a target range environment construction device for a cloud-native chaos engineering experiment, including: obtaining resource information of a container cloud Kubernetes cluster in an actual production environment; copying the resource information to a Kubernetes cluster of a target range environment to realize target range environment construction; obtaining actual call traffic in an actual production environment; forwarding the actual call traffic to the target range environment to realize the construction of target range environment traffic; in response to completing the construction of the target range environment and the target range environment traffic, obtaining a target target range environment. The present invention realizes the replication of a basic environment based on cloud-native backup and recovery technology, and replicates the production traffic to the target range environment based on traffic replication technology, thereby fully simulating the production environment and achieving the best effect of chaos engineering testing.
[0116] It should be noted that the specific implementation of each unit and sub-unit in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.
[0117] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this application, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0118] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0119] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for constructing a range environment for a cloud-native chaos engineering experiment, characterized in that: include: Obtain resource information of the Container Cloud Kubernetes cluster in the actual production environment; Copy the resource information to the Kubernetes cluster of the range environment to implement the range environment construction; Obtaining actual call traffic in the actual production environment; Forwarding the actual call traffic to the shooting range environment to realize the construction of the shooting range environment traffic; In response to completing the construction of the range environment and the range environment flow, obtaining a target range environment; The step of copying the resource information to the Kubernetes cluster of the range environment includes: Acquire the arrangement file corresponding to the resource information, and store the arrangement file in a target location; In response to copying the orchestration file at the target location to the Kubernetes cluster of the range environment, controlling the Kubernetes cluster to create a target object corresponding to the orchestration file; In response to starting a persistent container node on a working node in the range environment, reading a mount directory of persistent storage data of a business persistent container node in the production environment through the persistent container node; Copying the mount directory to the range environment to copy the persistent storage data to the range environment; The forwarding of the actual call traffic to the target range environment includes: determining traffic forwarding configuration information, wherein the traffic forwarding configuration information is used to add a container for traffic forwarding in the container of the actual production environment; intercepting the traffic of the actual production environment through the traffic forwarding configuration information, and sending the intercepted actual call traffic to the business container of the actual production environment, while forwarding the actual call traffic to the target range environment.
2. The method according to claim 1, characterized in that The obtaining of resource information of the container cloud Kubernetes cluster in the actual production environment includes: Determine the resource scope of the Container Cloud Kubernetes cluster in the actual production environment; Based on the target interface, resource information of the container cloud Kubernetes cluster in the actual production environment within the resource range is obtained, and the target interface is an application program interface based on the container cloud Kubernetes.
3. The method according to claim 1, characterized in that Also includes: Obtain task information carrying the target chaos experiment task; determining fault injection information based on the task information; The fault injection information is injected into a target range environment.
4. The method according to claim 3, characterized in that The method further comprises: In response to completing the injected fault test based on the target range environment, the target range environment is restored to obtain a restored range environment.
5. A device for constructing a range environment for a cloud-native chaos engineering experiment, characterized in that: include: The first acquisition unit is used to acquire resource information of the container cloud Kubernetes cluster in the actual production environment; A replication unit, used to replicate the resource information to the Kubernetes cluster of the range environment to implement the range environment construction; A second acquisition unit is used to acquire actual call traffic in the actual production environment; A forwarding unit, used for forwarding the actual call traffic to the shooting range environment to realize the construction of the shooting range environment traffic; a target acquisition unit, for obtaining a target range environment in response to completing the construction of the range environment and the range environment flow; The first acquisition unit is specifically used for: Determine the resource scope of the Container Cloud Kubernetes cluster in the actual production environment; Based on the target interface, resource information of the container cloud Kubernetes cluster in the actual production environment within the resource range is obtained, and the target interface is an application program interface based on the container cloud Kubernetes; The copying unit is specifically used to: obtain the orchestration file corresponding to the resource information, and store the orchestration file at a target location; in response to copying the orchestration file at the target location to the Kubernetes cluster of the range environment, control the Kubernetes cluster to create a target object corresponding to the orchestration file; in response to starting a persistent container node on a working node in the range environment, read the mount directory of the persistent storage data of the business persistent container node in the production environment through the persistent container node; copy the mount directory to the range environment to copy the persistent storage data to the range environment; The forwarding unit is specifically used to: determine traffic forwarding configuration information, where the traffic forwarding configuration information is used to add a container for traffic forwarding in the container of the actual production environment; intercept the traffic of the actual production environment through the traffic forwarding configuration information, and send the intercepted actual call traffic to the business container of the actual production environment, while forwarding the actual call traffic to the target range environment.
6. The device according to claim 5, characterized in that Also includes: The third acquisition unit is used to acquire task information carrying the target chaos experiment task; A determination unit, configured to determine fault injection information based on the task information; A fault injection unit, used to inject the fault injection information into a target range environment; The recovery unit is used to recover the target range environment in response to completing the injected fault test based on the target range environment to obtain a recovered range environment.
Citation Information
Patent Citations
Method and device for setting up test environment, electronic equipment and medium
CN110532170A
Automatic construction method and system for cloud native application vulnerability reproduction environment
CN111259406A