Kubernetes container file system path repair method, device, equipment, and media
By listening to the link status information between Kubernetes containers and external storage, automatically comparing and repairing file system paths, the problem of Kubernetes container volume file system paths becoming read-only state is solved, and automatic repair is achieved without manual intervention, improving business recovery efficiency and reducing maintenance costs.
Patent Information
- Application Number
- CN202210867301.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-07-22
AI Technical Summary
After the Kubernetes host loses contact with the external storage link, the Kubernetes container volume file system path becomes read-only, resulting in business exceptions. The existing technology requires manual intervention to recover, resulting in long-term business interruption.
By listening to the link status information between the Kubernetes container and external storage, the current directory read and write mode and the standard mode are automatically compared. If it is inconsistent, the container's occupation of the directory will be temporarily released and the file system path is repaired using operating system commands.
It realizes that the file system directory can be automatically repaired without manual intervention after the link is restored to normal, reduce operation and maintenance pressure, reduce cluster maintenance costs, improve repair efficiency, and ensure timely recovery of business.
Smart Images

Figure CN115113985B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud native storage technology, and in particular to a Kubernetes container file system path repair method, device, equipment, and medium. Background Art
[0002] With the continuous development of cloud-native technologies, Kubernetes (a containerized orchestration tool) has become the de facto standard for container orchestration. Cloud-native applications deployed on Kubernetes need to mount container volumes for data persistence. Cloud-native storage solutions based on the Container Storage Interface (CSI) are maturing. They map LUNs (Logical Unit Numbers) provided by external storage to the Kubernetes host, initialize the file system, and then mount them to host directories, providing them to application containers for data persistence. However, the link between the Kubernetes host and external storage can be interrupted for various reasons. If the interruption lasts longer than a certain time, the operating system will change the file system directory from normal read-write mode to read-only mode to protect data integrity. Even after the link between the host and storage is restored, the problem will not be automatically repaired, causing service anomalies until operations personnel discover and manually restore services. However, while waiting for operations personnel to discover and manually restore services, service interruptions can be prolonged, resulting in significant losses for users of critical services.
[0003] In summary, after the Kubernetes container volume file system path becomes read-only due to the loss of connection between the host and storage link, how to automatically repair the file system directory and return it to read-write mode without manual intervention after the link is restored to normal, ensuring timely business response and realizing automatic repair of the file system directory without additional hardware equipment and personnel is a technical problem to be solved in this field. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a Kubernetes container file system path repair method, device, equipment, and medium. After the Kubernetes container volume file system path becomes read-only due to a host and storage link loss, the file system directory can be automatically repaired and returned to read-write mode without manual intervention after the link is restored to normal, ensuring timely service recovery and achieving automatic file system directory repair without the need for additional hardware equipment and personnel. The specific solution is as follows:
[0005] In a first aspect, the present application discloses a Kubernetes container file system path repair method, comprising:
[0006] Receive first link status information generated by monitoring the link status between the Kubernetes container and the external storage;
[0007] searching for a corresponding current directory read-write mode based on the first link state information, and comparing the current directory read-write mode with a standard directory read-write mode to obtain a corresponding comparison result;
[0008] If the comparison results are inconsistent, the Kubernetes container file system path is repaired.
[0009] Optionally, before receiving the first link status information generated by monitoring the link status between the Kubernetes container and the external storage, the method further includes:
[0010] A link protocol that is pre-configured to monitor the link status between Kubernetes containers and external storage.
[0011] Optionally, before receiving the first link status information generated by monitoring the link status between the Kubernetes container and the external storage, the method further includes:
[0012] Monitor the link status between the Kubernetes container and external storage, and generate the current target link status information;
[0013] Determine whether the current target link state information is the first link state information.
[0014] Optionally, after determining whether the target link state information is the first link state information, the method further includes:
[0015] If the target link state information is not the first link state information, the target link state information is determined to be the second link state information, and corresponding alarm information is generated.
[0016] Optionally, after determining that the target link state information is the second link state information and generating corresponding alarm information, the method further includes:
[0017] The alarm information is notified to the operation and maintenance personnel via email and / or SMS so that the fault can be repaired on the relevant hardware equipment.
[0018] Optionally, if the comparison results are inconsistent, repairing the Kubernetes container file system path includes:
[0019] If the comparison results are inconsistent, the Kubernetes container file system path is repaired according to the standard directory read and write mode.
[0020] Optionally, if the comparison results are inconsistent, repairing the Kubernetes container file system path includes:
[0021] If the comparison results are inconsistent, search for a Kubernetes container using the current directory;
[0022] Release the occupation of the Kubernetes container and the current directory, and repair the Kubernetes container file system path according to the standard directory read and write mode.
[0023] In a second aspect, the present application discloses a Kubernetes container file system path repair device, comprising:
[0024] An information receiving module is configured to receive first link status information generated by monitoring the link status between the Kubernetes container and the external storage;
[0025] a result comparison module, configured to search for a corresponding current directory read-write mode based on the first link state information, and compare the current directory read-write mode with a standard directory read-write mode to obtain a corresponding comparison result;
[0026] A path repair module is used to repair the Kubernetes container file system path if the comparison results are inconsistent.
[0027] In a third aspect, the present application discloses an electronic device, comprising:
[0028] Memory, used to store computer programs;
[0029] A processor is configured to execute the computer program to implement the steps of the aforementioned disclosed Kubernetes container file system path repair method.
[0030] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed Kubernetes container file system path repair method are implemented.
[0031] It can be seen that the present application discloses a method for repairing the path of a Kubernetes container file system, comprising: receiving the first link status information generated by monitoring the link status between the Kubernetes container and the external storage; searching for the corresponding current directory read-write mode based on the first link status information, and comparing the current directory read-write mode with the standard directory read-write mode to obtain a corresponding comparison result; if the comparison result is inconsistent, repairing the Kubernetes container file system path. It can be seen that the present application perceives the link changes between Kubernetes and the storage system in real time, responds differently according to the changes, accurately judges whether the file system needs to be repaired, and requests the repair device to prepare the correct directory, and quickly repair the read-write mode to quickly locate the file system directory corresponding to the business container, without the need to re-execute the unloading and mounting steps through the CSI, and completes the repair of the read-write mode by temporarily releasing the container's occupation of the directory and using the operating system command. It reduces the pressure on operation and maintenance personnel, and also reduces the time wasted on manual repairs, reduces the maintenance cost of the cluster, and improves the repair efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0033] Figure 1 This is a flow chart of a Kubernetes container file system path repair method disclosed in this application;
[0034] Figure 2 This is a flowchart of a specific Kubernetes container file system path repair method disclosed in this application;
[0035] Figure 3 This is a flow chart of a method for automatically repairing a Kubernetes container volume file system path disclosed in this application;
[0036] Figure 4 This is a schematic diagram of the structure of a Kubernetes container file system path repair device disclosed in this application;
[0037] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described 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 making creative efforts are within the scope of protection of the present invention.
[0039] With the continuous development of cloud-native technologies, Kubernetes (a containerized orchestration tool) has become the de facto standard for container orchestration. Cloud-native applications deployed on Kubernetes need to mount container volumes for data persistence. Cloud-native storage solutions based on the Container Storage Interface (CSI) are maturing. They map LUNs (Logical Unit Numbers) provided by external storage to the Kubernetes host, initialize the file system, and then mount them to host directories, providing them to application containers for data persistence. However, the link between the Kubernetes host and external storage can be interrupted for various reasons. If the interruption lasts longer than a certain time, the operating system will change the file system directory from normal read-write mode to read-only mode to protect data integrity. Even after the link between the host and storage is restored, the problem will not be automatically repaired, causing service anomalies until operations personnel discover and manually restore services. However, while waiting for operations personnel to discover and manually restore services, service interruptions can be prolonged, resulting in significant losses for users of critical services.
[0040] To this end, the present application discloses a Kubernetes container file system path repair solution. After the Kubernetes container volume file system path becomes read-only due to the loss of connection between the host and storage link, the file system directory can be automatically repaired and returned to read-write mode without manual intervention after the link is restored to normal, ensuring timely response to business and realizing automatic repair of the file system directory without the need for additional hardware equipment and personnel.
[0041] Reference Figure 1 As shown, an embodiment of the present invention discloses a Kubernetes container file system path repair method, comprising:
[0042] Step S11: Receive first link status information generated by monitoring the link status between the Kubernetes container and the external storage.
[0043] In this embodiment, Kubernetes is an open-source containerized orchestration tool used to manage containerized applications on multiple hosts in a cloud platform. It offers advantages such as high availability and elastic scalability. Therefore, during the automatic repair of the K8S container volume file system path, it is necessary to pre-deploy all components to the K8S cluster and configure initialization parameters.
[0044] In this embodiment, before receiving the first link state information generated by monitoring the link state between the Kubernetes container and the external storage, the method further includes: pre-configuring a link protocol for monitoring the link state between the Kubernetes container and the external storage. It is understood that the iSCSI or FC link state protocol is pre-configured so that the link state monitoring device can monitor the configured link state protocol and obtain corresponding link state information. It should be noted that the configured link state protocol can also be other link state protocols in addition to the above two protocols. This is merely an example and is not intended to be limiting.
[0045] In this embodiment, a link status monitoring device is used to monitor the link status between the host's network card and the switch connected to the storage system, and monitor the link status between the switch and the storage system. It can be understood that only the above two link states are monitored, where as long as one of the two link states is abnormal, it means that the link between the business and the storage is abnormal. Only when both are normal can it be said that the link between the business and the storage is normal. Therefore, the link status between the monitored Kubernetes container and the external storage is compared with the last saved link status. If it is found that the last saved link status is an abnormal link status and the current link status is a normal link status, the latest link status is saved, and the first link status that changes from an abnormal link status to a normal link status is reported to the status repair arbiter. That is, the first link status in this embodiment is that the current link status is compared with the last link status, and the link status changes from an abnormal link status to a normal link status. Therefore, it can also be known that the current hardware has no fault problem, or the hardware with problems at the current moment has been completely repaired, and the current link status between the Kubernetes container and the external storage is a normal link status.
[0046] Step S12: searching for a corresponding current directory read-write mode based on the first link state information, and comparing the current directory read-write mode with a standard directory read-write mode to obtain a corresponding comparison result.
[0047] In this embodiment, a state repair arbiter is used to receive an event reported by a link state monitoring device that the link between the K8S host and the storage system has changed from abnormal to normal, and to determine whether the corresponding host file system directory needs to be repaired. The repair device is then reported with the result of the determination to search for the corresponding file system directory, obtain the current directory read and write mode, and compare it with the mode expected by K8S. The directory read and write mode is the operating permission of the user or program for a directory on the operating system, including read-only mode, read-write mode, etc. In this embodiment, the file directory read and write mode under normal link state is generally read-write mode, while the file directory read and write mode under abnormal link state is generally read-only mode. In this way, the corresponding current read and write mode is searched according to the current link state information, and compared with the standard directory read and write mode to obtain the corresponding comparison result. For example, when the current link state information is obtained as a normal link state, the corresponding current directory read and write mode is read according to the predetermined correspondence, and the current directory read and write mode is compared with the standard read and write mode to obtain the corresponding comparison result.
[0048] Step S13: If the comparison results are inconsistent, the Kubernetes container file system path is repaired.
[0049] In this embodiment, if the comparison results are inconsistent, the Kubernetes container file system path is repaired according to the standard directory read-write mode. It is understandable that if the comparison results are inconsistent, the Kubernetes container using the current directory is searched; the occupation of the Kubernetes container and the current directory is released, and the Kubernetes container file system path is repaired according to the standard directory read-write mode. If the two are inconsistent, it means that the directory needs to be repaired, and the read-write mode expected by K8S is notified to the directory automatic repair device to perform read-write mode repair. For example: the directory read-write mode of the current link connection state is read-only mode, but the standard directory read-write mode corresponding to the current link connection state is read-write mode, then the Kubernetes container file system path needs to be repaired based on the read-write mode. After receiving the repair notification, the file system automatic repair device first interacts with K8S to find the business container using the directory and temporarily releases the business container's occupation of the directory, and then interacts with the host operating system to repair the directory's read-write mode through the repair command. After success, the mapping relationship between the directory and the business container is restored.
[0050] It can be seen that the present application discloses a method for repairing the path of a Kubernetes container file system, comprising: receiving the first link status information generated by monitoring the link status between the Kubernetes container and the external storage; searching for the corresponding current directory read-write mode based on the first link status information, and comparing the current directory read-write mode with the standard directory read-write mode to obtain a corresponding comparison result; if the comparison result is inconsistent, repairing the Kubernetes container file system path. It can be seen that the present application perceives the link changes between Kubernetes and the storage system in real time, responds differently according to the changes, accurately judges whether the file system needs to be repaired, and requests the repair device to prepare the correct directory, and quickly repair the read-write mode to quickly locate the file system directory corresponding to the business container, without the need to re-execute the unloading and mounting steps through the CSI, and completes the repair of the read-write mode by temporarily releasing the container's occupation of the directory and using the operating system command. It reduces the pressure on operation and maintenance personnel, and also reduces the time wasted on manual repairs, reduces the maintenance cost of the cluster, and improves the repair efficiency.
[0051] Reference Figure 2 As shown, the embodiment of the present invention discloses a specific method for repairing the path of a Kubernetes container file system. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically:
[0052] Step S21: monitor the link status between the Kubernetes container and the external storage, and generate current target link status information; determine whether the current target link status information is the first link status information.
[0053] In this embodiment, the link status changes between the local machine and the storage system are first monitored in real time. If the link status changes from normal to abnormal, an alarm needs to be directly generated to inform the operation and maintenance personnel of the hardware failure and the need for timely repair. If the link status changes from abnormal to normal, for example: the hardware failure is repaired, if the link remains in the abnormal state for more than the time specified by the operating system before returning to normal, it means that the directory of the file system corresponding to the original read-write mode of the operating system has changed to read-only mode. The device needs to automatically repair the directory of the corresponding file system to read-write mode to ensure that the business data can be stored on the disk normally.
[0054] In this embodiment, after determining whether the target link status information is the first link status information, it also includes: if the target link status information is not the first link status information, determining that the target link status information is the second link status information, and generating corresponding alarm information. It can be understood that the second link status information is the current link status compared to the previous link status, which is changed from a normal link status to an abnormal link status, that is, a hardware failure has occurred, and an alarm information needs to be generated immediately to inform the operation and maintenance personnel to promptly understand the hardware failure. It can be understood that when a physical failure occurs in the link between the K8S host and the storage system, the operation and maintenance personnel can be notified in time to repair it, reducing the business system interruption time caused by the failure. After the physical failure is repaired, the link status can be sensed in time to have returned to normal and the file system directory can be automatically repaired. Compared with manual repair, it can be more timely and stable. The operation and maintenance personnel only need to pay attention to the physical failure of the link. After the physical failure is repaired, there is no need to manually repair the business interruption caused by the read-only file system directory, thereby reducing the maintenance cost of the K8S cluster.
[0055] In this embodiment, after determining that the target link status information is the second link status information and generating the corresponding alarm information, it also includes: notifying the operation and maintenance personnel of the alarm information by email and / or text message, so as to perform fault repair operations on the relevant hardware equipment. It can be understood that the K8S platform alarm system receives the event that the link between the K8S host and the storage system changes from normal to abnormal, which is reported by the link status monitoring device, and generates an alarm. It should be noted that it is necessary to pre-deploy the link status monitoring device, the directory repair arbiter, and the file system directory automatic repair device to the host where the customer business is running in the K8S cluster. The host is also the business node. The K8S platform alarm system is deployed to the control node of the K8S cluster and connected to the SMS system or email system so that the link failure event it receives can be notified to the operation and maintenance personnel in a timely manner in the form of SMS or email.
[0056] It should be noted that the state repair arbiter can accurately determine whether which directories need to be in read-write mode, and cannot forcibly modify all directories. In addition, when automatically repairing directories, there is no need to repair the directories by restarting and mounting volumes in K8S through CSI (Container Storage Interface). There is no need to decouple the orchestration system and storage plug-in. Instead, the recovery time is reduced by temporarily releasing the container's occupation of the directory and then repairing it through the repair command.
[0057] Step S22: Receive the first link status information generated by monitoring the link status between the Kubernetes container and the external storage.
[0058] Step S23: searching for a corresponding current directory read-write mode based on the first link status information, and comparing the current directory read-write mode with a standard directory read-write mode to obtain a corresponding comparison result.
[0059] Step S24: If the comparison results are inconsistent, the Kubernetes container file system path is repaired.
[0060] For more detailed processing procedures of steps S22, S23, and S24, please refer to the aforementioned disclosed embodiments, which will not be described again here.
[0061] Reference Figure 3As shown, a K8S container volume file system path automatic repair composition architecture mainly includes four parts: a link status monitoring device, a directory repair arbiter, a file system directory automatic repair device, and a K8S platform alarm system, which are introduced as follows: The link status monitoring device is responsible for monitoring the link status between the k8s host and the external storage, and if it detects a change in the link status between the two, it reports it to different systems. The status repair arbiter receives the event reported by the link status monitoring device that the link between the K8S host and the storage system changes from abnormal to normal, and determines whether to repair the corresponding host file system directory, and reports the decision result to the repair device. The K8S platform alarm system receives the event reported by the link status monitoring device that the link between the K8S host and the storage system changes from normal to abnormal, and generates an alarm. The file system directory automatic repair device is responsible for repairing the read and write mode of the file system directory to the mode expected by K8S. First, when the link monitoring device monitors the link status of the two groups of paths, it checks whether the link status has changed. If there is no change, the monitoring state is maintained for continuous monitoring; if there is a change, the link status information is judged to determine whether it is the first link status or the second link status. If it is the first link status, that is, the abnormal link status becomes the normal link status, an automatic repair decision operation is performed to make a decision on the current link status. If the result of the decision is that no repair is required, the previous read-only operation is maintained, and the system is continued to be monitored through the link monitoring device; if the result of the decision is that repair is required, the file directory is repaired through the automatic repair device, and when the repair is completed, it continues to return to the link monitoring device to continue monitoring the system; if it is the second link status, That is, if the normal link state changes to an abnormal link state, it means that the hardware of the current system has failed. In this case, an alarm message is directly generated through the alarm system to notify the operation and maintenance personnel so that the operation and maintenance personnel can directly repair the hardware. In this embodiment, the current state of the file system path corresponding to the external storage LUN is automatically sensed and compared with the initial state of the system setting and the link state between the K8S host and the external storage. Finally, it is determined whether the current path needs to be changed from read-only to read-write, and the file system is automatically repaired according to the determination result. In the specific repair process, the file system directory corresponding to the business container is first quickly located without the need to re-execute the unmounting and mounting steps through the CSI. By temporarily releasing the container from occupying the directory, the operating system command is used to complete the repair of the read-write mode.
[0062] It can be seen that this application can implement the perception of link changes between the host and the storage system by deploying a link status monitoring device on the host running the business in the K8S cluster, and make different responses according to the changes, so that the state repair arbiter can accurately judge whether the file system needs to be repaired, and request the repair device to prepare the correct directory and quickly repair the read-write mode. After the K8S container volume file system path becomes read-only due to the loss of connection between the host and the storage link, it can automatically repair the file system directory and change it to read-write mode without manual intervention after the link returns to normal to ensure timely response of the business. It is also convenient and simple to implement automatic repair of the file system directory without the need for additional hardware equipment and personnel, which not only saves customers' operation and maintenance costs, but also long-term interruptions of key businesses will cause greater losses to users. Therefore, the solution of this application can greatly improve the stability of customer business.
[0063] Reference Figure 4 As shown, an embodiment of the present invention discloses a Kubernetes container file system path repair device, comprising:
[0064] An information receiving module 11 is configured to receive first link status information generated by monitoring the link status between the Kubernetes container and the external storage;
[0065] a result comparison module 12, configured to search for a corresponding current directory read / write mode based on the first link state information, and compare the current directory read / write mode with a standard directory read / write mode to obtain a corresponding comparison result;
[0066] The path repair module 13 is used to repair the Kubernetes container file system path if the comparison result is inconsistent.
[0067] The information receiving module 11 is configured to receive the first link status information generated by monitoring the link status between the Kubernetes container and the external storage, and further includes: pre-configuring a link protocol for monitoring the link status between the Kubernetes container and the external storage. It is understood that the iSCSI or FC link status protocol is pre-configured so that the link status monitoring device can monitor the configured link status protocol and obtain corresponding link status information. It should be noted that the configured link status protocol can also be other link status protocols in addition to the above two protocols. This is only an example and is not limited to this. A link status monitoring device is used to monitor the link status between the host's network card and the switch connected to the storage system, and the link status between the switch and the storage system. It can be understood that only the above two link statuses are monitored, where as long as one of the two link statuses is abnormal, it means that the link between the business and the storage is abnormal. Only when both are normal can it be said that the link between the business and the storage is normal. Therefore, the link status between the monitored Kubernetes container and the external storage is compared with the last saved link status. If it is found that the last saved link status is an abnormal link status and the current link status is a normal link status, the latest link status is saved, and the first link status that changes from an abnormal link status to a normal link status is reported to the status repair arbiter. That is, the first link status in this embodiment is that the current link status is compared with the last link status, and the link status changes from an abnormal link status to a normal link status. Therefore, it can also be known that the current hardware has no fault problem, or the hardware with problems at the current moment has been completely repaired, and the current link status between the Kubernetes container and the external storage is a normal link status.
[0068] The result comparison module 12 is used to execute the event of the link between the K8S host and the storage system changing from abnormal to normal, which is received by the link status monitoring device using the status repair determiner, and determine whether to repair the corresponding host file system directory, and use the determination result to report the repair device to find the corresponding file system directory, obtain the current directory read and write mode and compare it with the mode expected by K8S. The directory read and write mode is the user or program's operating permission for a directory on the operating system, including read-only mode, read-write mode, etc. In this embodiment, the file directory read and write mode under the normal link state is generally read-write mode, while the file directory read and write mode under the abnormal link state is generally read-only mode. In this way, the corresponding current read and write mode will be searched according to the current link status information, and compared with the standard directory read and write mode to obtain the corresponding comparison result. For example: when the current link status information is obtained as a normal link state, the corresponding current directory read and write mode is read according to the predetermined correspondence, and the current directory read and write mode is compared with the standard read and write mode to obtain the corresponding comparison result.
[0069] The path repair module 13 is used to perform a repair of the Kubernetes container file system path according to the standard directory read-write mode if the comparison results are inconsistent. It is understandable that if the comparison results are inconsistent, the Kubernetes container using the current directory is searched; the occupation of the Kubernetes container and the current directory is released, and the Kubernetes container file system path is repaired according to the standard directory read-write mode. If the two are inconsistent, it means that the directory needs to be repaired, and the read-write mode expected by K8S is notified to the directory automatic repair device to perform read-write mode repair. For example: the directory read-write mode of the current link connection state is read-only mode, but the standard directory read-write mode corresponding to the current link connection state is read-write mode, then the Kubernetes container file system path needs to be repaired based on the read-write mode. After receiving the repair notification, the file system automatic repair device first interacts with K8S to find the business container using the directory and temporarily releases the business container's occupation of the directory, and then interacts with the host operating system to repair the directory's read-write mode through a repair command. After success, the mapping relationship between the directory and the business container is restored.
[0070] It can be seen that the present application discloses a method for repairing the path of a Kubernetes container file system, comprising: receiving the first link status information generated by monitoring the link status between the Kubernetes container and the external storage; searching for the corresponding current directory read-write mode based on the first link status information, and comparing the current directory read-write mode with the standard directory read-write mode to obtain a corresponding comparison result; if the comparison result is inconsistent, repairing the Kubernetes container file system path. It can be seen that the present application perceives the link changes between Kubernetes and the storage system in real time, responds differently according to the changes, accurately judges whether the file system needs to be repaired, and requests the repair device to prepare the correct directory, and quickly repair the read-write mode to quickly locate the file system directory corresponding to the business container, without the need to re-execute the unloading and mounting steps through the CSI, and completes the repair of the read-write mode by temporarily releasing the container's occupation of the directory and using the operating system command. It reduces the pressure on operation and maintenance personnel, and also reduces the time wasted on manual repairs, reduces the maintenance cost of the cluster, and improves the repair efficiency.
[0071] In some specific implementations, the information receiving module 11 may specifically include:
[0072] The protocol configuration unit is used to pre-configure the link protocol for monitoring the link status between the Kubernetes container and the external storage.
[0073] In some specific implementations, the information receiving module 11 may specifically include:
[0074] The monitoring submodule is used to monitor the link status between the Kubernetes container and the external storage, and generate current target link status information; and determine whether the current target link status information is the first link status information.
[0075] In some specific implementations, the monitoring submodule may specifically include:
[0076] The information judgment unit is configured to judge that the target link status information is the second link status information if the target link status information is not the first link status information, and generate corresponding alarm information.
[0077] In some specific implementations, the Kubernetes container file system path repair device may specifically include:
[0078] The information notification unit is used to notify the operation and maintenance personnel of the alarm information by email and / or text message so that the fault repair operation can be performed on the relevant hardware equipment.
[0079] In some specific implementations, the path repair module 13 may specifically include:
[0080] The repair submodule is used to repair the Kubernetes container file system path according to the standard directory read and write mode if the comparison results are inconsistent.
[0081] In some specific embodiments, the repair submodule may specifically include:
[0082] The deoccupancy unit is configured to, if the comparison result is inconsistent, search for a Kubernetes container that uses the current directory; deoccupy the Kubernetes container from the current directory, and repair the Kubernetes container file system path according to the standard directory read and write mode.
[0083] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation to the scope of application of the present application.
[0084] Figure 5This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the Kubernetes container file system path repair method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0085] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0086] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0087] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0088] Among them, the operating system 221 is used to manage and control the various hardware devices and computer programs 222 on the electronic device 20 to enable the processor 21 to calculate and process the massive data 223 in the memory 22. It can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the Kubernetes container file system path repair method executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include computer programs that can be used to complete other specific tasks. In addition to including data received by the electronic device and transmitted from an external device, the data 223 can also include data collected by its own input and output interface 25.
[0089] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when executed by a processor, the computer program implements the aforementioned disclosed method for repairing a Kubernetes container file system path. The specific steps of this method can be referred to the corresponding content disclosed in the aforementioned embodiments and will not be repeated here.
[0090] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0091] Professionals can also further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly with hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0092] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0093] The above is a detailed introduction to the Kubernetes container file system path repair method, device, equipment, and medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A Kubernetes container file system path repair method, characterized in that: include: Receive first link status information generated by monitoring the link status between the Kubernetes container and the external storage; searching for a corresponding current directory read-write mode based on the first link state information, and comparing the current directory read-write mode with a standard directory read-write mode to obtain a corresponding comparison result; If the comparison results are inconsistent, the Kubernetes container file system path is repaired; If the comparison results are inconsistent, repairing the Kubernetes container file system path includes: If the comparison results are inconsistent, search for a Kubernetes container using the current directory; Release the Kubernetes container and the current directory from use, and repair the Kubernetes container file system path according to the standard directory read and write mode; Repairing the Kubernetes container file system path according to the standard directory read and write mode includes: Repair directory read and write permissions using operating system commands and following standard directory read and write modes.
2. The Kubernetes container file system path repair method according to claim 1, characterized in that: Before receiving the first link status information generated by monitoring the link status between the Kubernetes container and the external storage, the method further includes: A link protocol that is pre-configured to monitor the link status between Kubernetes containers and external storage.
3. The Kubernetes container file system path repair method according to claim 1, characterized in that: Before receiving the first link status information generated by monitoring the link status between the Kubernetes container and the external storage, the method further includes: Monitor the link status between the Kubernetes container and external storage, and generate the current target link status information; Determine whether the current target link state information is the first link state information.
4. The Kubernetes container file system path repair method according to claim 3 is characterized in that: After determining whether the target link state information is the first link state information, the method further includes: If the target link state information is not the first link state information, the target link state information is determined to be the second link state information, and corresponding alarm information is generated.
5. The Kubernetes container file system path repair method according to claim 4 is characterized in that: After determining that the target link state information is the second link state information and generating corresponding alarm information, the method further includes: The alarm information is notified to the operation and maintenance personnel via email and / or SMS so that the fault can be repaired on the relevant hardware equipment.
6. The Kubernetes container file system path repair method according to any one of claims 1 to 5, characterized in that: If the comparison results are inconsistent, the Kubernetes container file system path is repaired, including: If the comparison results are inconsistent, the Kubernetes container file system path is repaired according to the standard directory read and write mode.
7. A Kubernetes container file system path repair device, characterized in that: include: An information receiving module is configured to receive first link status information generated by monitoring the link status between the Kubernetes container and the external storage; a result comparison module, configured to search for a corresponding current directory read-write mode based on the first link state information, and compare the current directory read-write mode with a standard directory read-write mode to obtain a corresponding comparison result; A path repair module, used to repair the Kubernetes container file system path if the comparison results are inconsistent; The path repair module is specifically used to search for a Kubernetes container using the current directory if the comparison result is inconsistent; release the occupation of the Kubernetes container and the current directory, and repair the Kubernetes container file system path according to the standard directory read and write mode; The Kubernetes container file system path repair device is specifically used to repair directory read and write permissions through operating system commands and in accordance with the standard directory read and write mode.
8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the Kubernetes container file system path repair method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, the steps of the Kubernetes container file system path repair method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Dual-port PCIe SSD link fault tolerance device and method
CN113114595A