Methods, apparatus, equipment, and media for maintaining consistency between host machine and container group numbering
By retrieving the host machine's GID and UID from a pre-defined database during container creation and adding them to the container group's context security attributes, the problem of inefficient GID and UID consistency between the host machine and the container group is solved, achieving automated GID and UID consistency management.
Patent Information
- Application Number
- CN201910564470.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-26
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2039-06-26
AI Technical Summary
The existing methods for maintaining consistency of GID and UID between the host machine and container group are inefficient and require manual operation.
When a container creation request is received, the host machine's GID and UID are retrieved from a pre-defined database based on the user identifier, and then added to the context security attributes of the container group to be created, thereby ensuring consistency between the host machine's GID and UID and the container group's GID and UID.
It enables the automatic acquisition of the host machine's GID and UID during the container group creation process, improving the efficiency of GID and UID consistency between the host machine and the container group.
Smart Images

Figure CN110308968B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing of financial technology (Fintech), and in particular to a method and device for maintaining consistency between host and container group numbers, equipment and medium. BACKGROUND
[0002] With the continuous development of financial technology, especially Internet technology finance, more and more technologies (such as distributed, big data, Blockchain, artificial intelligence, etc.) are applied in the financial field, but the financial industry also puts forward higher requirements for technology, such as higher requirements for operation permissions in the online interaction process of the financial industry.
[0003] Kubernetes, simply K8s (container cluster management system), is an abbreviation of 8 instead of 8 characters "ubernete". It is an open source system for managing containerized applications on multiple hosts in the cloud platform. The goal of Kubernetes is to make it simple and powerful to deploy containerized applications. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance. Pod is a container group, which is the smallest unit of container application running in a K8s cluster, and can use Node Selector by default. Pod Security Context (Pod Context Security) is an attribute of Pod, which can set the permissions of Pod containers through the definition of this attribute, including GID and UID in the container. GID and UID are the abbreviations of Group ID and User ID in the Linux operating system, that is, group number and user number. In the Linux operating system, any file and directory has a UID and GID, indicating that the user corresponding to the UID and the user group corresponding to the GID have the ownership of the file or folder. Except for the root user, only the user or the user in the user group has complete operation permission on the file. Deployment is one of the units of container application running in a K8s cluster (other units at the same level are StatefulSet, DaemonSet, etc.), which contains several container groups, and Deployment cannot use Node Selector by default.
[0004] Currently, Pod Security Context, as a native mechanism of Kubernetes, effectively manages the operation permissions of container applications. Users can set specific GIDs and UIDs for specific containers as needed, ensuring that the container's file system operation permissions are consistent with those on the host Node. A Node is a compute node in a Kubernetes cluster, a collection of hardware that supports various container applications. Container operation depends on different resources on each Node, such as CPU (Central Processing Unit), memory, disk, and GPU (Graphics Processing Unit). Each Kubernetes cluster contains several Nodes. When adding the Pod Security Context attribute to a Pod within a Deployment, the corresponding GID and UID for each Pod must be manually added to ensure that the GIDs and UIDs used by the containers within the Pod are consistent with their corresponding GIDs and UIDs on the host machine. Therefore, maintaining consistency of GIDs and UIDs between the host machine and the container group currently requires manual user intervention, making it inefficient. Summary of the Invention
[0005] The main objective of this invention is to provide a method, apparatus, device, and medium for maintaining consistency between host machine and container group numbers, aiming to solve the problem of low efficiency in maintaining consistency between GID and UID in existing technologies.
[0006] To achieve the above objective, the present invention provides a method for maintaining consistency between the host machine and container group IDs, the method comprising the steps of:
[0007] Upon receiving a container creation request to create a container group, the container group to be created is determined based on the container creation request, and the user identifier corresponding to the container group to be created is obtained.
[0008] Retrieve the group ID (GID) and user ID (UID) corresponding to the user identifier from the preset database, wherein the preset database stores the GID and UID of the host machine corresponding to the container group;
[0009] The GID and UID are added to the context security attributes of the container group to be created to obtain a container creation request carrying the GID and UID, so that the host GID and UID are consistent with the corresponding GID and UID in the container group to be created.
[0010] Preferably, before the step of determining the container group to be created based on the container creation request and obtaining the user identifier corresponding to the container group to be created after receiving the container creation request, the method further includes:
[0011] Upon receiving an information creation request to create user information, the user identifier corresponding to the information creation request is determined.
[0012] Obtain the GID and UID of the host machine corresponding to the container group, and associate the obtained GID and UID of the host machine with the user identifier corresponding to the information creation request and store them in a preset database.
[0013] Preferably, before the step of associating the acquired GID and UID from the host machine with the user identifier corresponding to the information creation request and storing them in a preset database, the method further includes:
[0014] Obtain the identity information of the user corresponding to the information creation request, and check whether the identity information passes the verification;
[0015] If the identity information is detected to pass the verification, then the step of associating the obtained GID and UID from the host machine with the user identifier corresponding to the information creation request and storing them in a preset database is executed.
[0016] Preferably, the step of obtaining the identity information of the user corresponding to the information creation request and detecting whether the identity information passes verification includes:
[0017] Obtain the username and password of the user corresponding to the information creation request, and check whether there is a preset username with the same username and a preset password with the same password in the user management system;
[0018] If a preset username identical to the username of the user corresponding to the information creation request is detected in the user management system, and a preset password identical to the password of the user is detected, then the identity information is determined to have passed the verification.
[0019] Preferably, after the steps of obtaining the GID and UID of the host machine corresponding to the container group, associating the obtained GID and UID of the host machine with the user identifier corresponding to the information creation request and storing them in a preset database, the method further includes:
[0020] Upon receiving a modification instruction to modify the GID and / or UID, the GID and / or UID stored in the preset database are modified accordingly based on the modification instruction.
[0021] Preferably, the step of determining the container group to be created based on the container creation request and obtaining the user identifier corresponding to the container group to be created after receiving the container creation request includes:
[0022] Upon receiving a container creation request to create a container group, the identity information of the user corresponding to the container creation request is obtained;
[0023] If the identity information of the user corresponding to the container creation request is verified, then the container group to be created is determined based on the container creation request, and the user identifier corresponding to the container group to be created is obtained.
[0024] Preferably, after the step of adding the GID and UID to the context security attributes of the container group to be created to obtain a container creation request carrying the GID and UID, so that the host GID and UID are consistent with the corresponding GID and UID in the container group to be created, the method further includes:
[0025] The container creation request carrying the GID and UID is sent to the container cluster management system Kubernetes cluster, so that the Kubernetes cluster can create the container group to be created based on the container creation request carrying the GID and UID.
[0026] Furthermore, to achieve the above objectives, the present invention also provides an apparatus for maintaining consistency between the host machine and container group numbers, the apparatus comprising:
[0027] The determination module is used to determine the container group to be created based on the container creation request after receiving the container creation request.
[0028] The acquisition module is used to acquire the user identifier corresponding to the container group to be created; and to acquire the group number GID and user number UID corresponding to the user identifier from a preset database, wherein the preset database stores the GID and UID of the host machine corresponding to the container group;
[0029] An add module is used to add the GID and UID to the context security attributes of the container group to be created, and obtain a container creation request carrying the GID and UID, so that the host GID and UID are consistent with the corresponding GID and UID in the container group to be created.
[0030] Furthermore, the determining module is also used to determine the user identifier corresponding to the information creation request after receiving the information creation request for creating user information;
[0031] The acquisition module is also used to acquire the GID and UID of the host machine corresponding to the container group;
[0032] The means for maintaining consistency between the host machine and container group numbers also includes:
[0033] The storage module is used to associate the acquired GID and UID from the host machine with the user identifier corresponding to the information creation request and store them in a preset database.
[0034] Furthermore, the acquisition module is also used to acquire the identity information of the user corresponding to the information creation request;
[0035] The means for maintaining consistency between the host machine and container group numbers also includes:
[0036] The detection module is used to detect whether the identity information passes the verification.
[0037] The storage module is also used to associate the obtained GID and UID from the host machine with the user identifier corresponding to the information creation request and store them in a preset database if the identity information is detected to have passed the verification.
[0038] Furthermore, the acquisition module is also used to acquire the username and password of the user corresponding to the information creation request;
[0039] The detection module is also used to detect whether there is a preset username that is the same as the username in the user management system, and whether there is a preset password that is the same as the user password.
[0040] The determining module is further configured to determine that the identity information passes verification if it detects that there is a preset username in the user management system that is the same as the username of the user corresponding to the information creation request, and a preset password that is the same as the password of the user.
[0041] Furthermore, the means for maintaining consistency between the host machine and container group numbers also includes:
[0042] The modification module is used to modify the GID and / or UID stored in the preset database according to the modification instruction when it receives a modification instruction to modify the GID and / or UID.
[0043] Furthermore, to achieve the above objectives, the present invention also provides a device for maintaining the consistency of host machine and container group numbers. The device for maintaining the consistency of host machine and container group numbers includes a memory, a processor, and a program stored in the memory and executable on the processor for maintaining the consistency of host machine and container group numbers. When the program for maintaining the consistency of host machine and container group numbers is executed by the processor, it implements the steps of the method for maintaining the consistency of host machine and container group numbers as described above.
[0044] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a program for maintaining the consistency of host machine and container group numbers, wherein when the program for maintaining the consistency of host machine and container group numbers is executed by a processor, it implements the steps of the method for maintaining the consistency of host machine and container group numbers as described above.
[0045] This invention improves the efficiency of maintaining GID and UID consistency between the host machine and the container group by determining the user identifier corresponding to the container group to be created based on the container creation request during container resource creation. It retrieves the corresponding GID and UID from a preset database storing the host machine's GID and UID, and adds them to the context security attributes of the container group to ensure consistency between the host machine's GID and UID and the corresponding GID and UID in the container group. Attached Figure Description
[0046] Figure 1 This is a flowchart illustrating the first embodiment of the method for maintaining consistency between host machine and container group numbers according to the present invention;
[0047] Figure 2 This is a flowchart illustrating the second embodiment of the method for maintaining consistency between host machine and container group numbers according to the present invention;
[0048] Figure 3 This is a functional schematic diagram of a preferred embodiment of the device for maintaining consistency between host machine and container group numbering according to the present invention;
[0049] Figure 4 This is a schematic diagram of the hardware operating environment involved in the embodiments of the present invention.
[0050] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0051] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0052] This invention provides a method for maintaining consistency between host machine and container group numbers, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the method for maintaining consistency between host machine and container group numbers according to the present invention.
[0053] This invention provides an embodiment of a method for maintaining consistency between host machine and container group numbers. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0054] The method for maintaining consistency between host machine and container group numbers is applied to a container creation system, which can be a system corresponding to a financial institution. In various embodiments of the method for maintaining consistency between host machine and container group numbers, the execution entity is omitted from the description of each embodiment for ease of explanation.
[0055] Methods to maintain consistency between host machine and container group IDs include:
[0056] Step S10: Upon receiving a container creation request to create a container group, determine the container group to be created based on the container creation request and obtain the user identifier corresponding to the container group to be created.
[0057] It's important to note that when a Kubernetes container mounts an external path on the host machine, the host machine's UID and GID are inherited. This means that when a user reads or writes files to the mounted external path, the UID and GID of the files stored on the host machine in that external path will match the UID and GID in the container, ensuring consistent read / write permissions between the container and the host machine. Upon receiving a container creation request for a container group, the system determines the container group to be created based on the request and obtains the user identifier corresponding to that container group. The container creation request can be triggered by the user based on specific needs or by a scheduled task. The request carries the container group name, the container's security context attributes, and the user identifier corresponding to the user operating on the container group. Essentially, the container group name in the request identifies the container group to be created, and the user identifier is the user identifier corresponding to the container group. The user identifier can be the user's username used to log in to the container creation system, or a phone number or ID card number.
[0058] Step S20: Obtain the group ID (GID) and user ID (UID) corresponding to the user identifier from the preset database, wherein the preset database stores the GID and UID of the host machine corresponding to the container group.
[0059] Once the user identifier corresponding to the container group to be created is obtained, the corresponding GID and UID are retrieved from the preset database. The preset database stores the GID and UID of the host machine corresponding to the container group. It should be noted that each user has a corresponding GID and UID, and in the preset database, each user's user identifier and its corresponding GID and UID are stored in association.
[0060] Step S30: Add the GID and UID to the context security attributes of the container group to be created, and obtain a container creation request carrying the GID and UID, so that the host GID and UID are consistent with the corresponding GID and UID in the container group to be created.
[0061] Once the GID and UID corresponding to the user identifier are retrieved from the pre-defined database, they are added to the context security attributes of the container group to be created, resulting in a container creation request carrying the GID and UID. It's important to note that each container group to be created contains only one user's GID and UID. If a container creation request corresponds to multiple container groups, the GID and UID are added sequentially to the context security attributes of each container group. In essence, one user can correspond to multiple container groups. Because the GID and UID added to the context security attributes of the container group to be created are retrieved from the pre-defined database, which stores the GID and UID from the host machine, it ensures that the GID from the host machine and the GID in the container group to be created are consistent, as are the UIDs from the host machine and the UIDs in the container group to be created. For example, when creating container resources for user a, the system reads user a's GID=3000 and UID=3000 from the preset database and adds GID=3000 and UID=3000 to the Pod Security Context attribute of the container group Pod to be created.
[0062] Furthermore, methods for maintaining consistency between host machine and container group IDs also include:
[0063] Step a: Send the container creation request carrying the GID and UID to the K8s cluster so that the K8s cluster can create the container group to be created based on the container creation request carrying the GID and UID.
[0064] Upon receiving a container creation request carrying its GID and UID, the Kubernetes cluster's API (Application Programming Interface) is invoked. This API sends the container creation request, containing the cluster's GID and UID, to the Kubernetes cluster. The Kubernetes cluster then creates the container group based on this request, ensuring that the GID and UID in the created container group match those on the host machine. When the created container group is run, all files associated with that container group will carry the corresponding GID and UID.
[0065] This embodiment determines the user identifier corresponding to the container group to be created based on the container creation request when creating container resources. It then retrieves the corresponding GID and UID from a preset database storing the host machine's GID and UID, and adds the retrieved host machine GID and UID to the context security attributes of the container group to be created. This ensures that the host machine GID and UID are consistent with the corresponding GID and UID in the container group. This achieves automatic retrieval of the host machine's GID and UID during container group creation, guaranteeing consistency between the GID and UID in the created container group and the host machine, thus improving the efficiency of maintaining GID and UID consistency between the host machine and the container group.
[0066] Furthermore, a second embodiment of the method for maintaining consistency between host machine and container group numbering according to the present invention is proposed.
[0067] The second embodiment of the method for maintaining consistency between host machine and container group numbers differs from the first embodiment in that, referring to... Figure 2 Other methods for maintaining consistency between host machine and container group IDs include:
[0068] Step S40: Upon receiving an information creation request to create user information, determine the user identifier corresponding to the information creation request.
[0069] Step S50: Obtain the GID and UID of the host machine corresponding to the container group, and associate the obtained GID and UID of the host machine with the user identifier corresponding to the information creation request and store them in a preset database.
[0070] Upon receiving a request to create user information, the system retrieves the user identifier carried in the request to determine the corresponding user identifier. It also retrieves the GID and UID from the host machine corresponding to the container group and associates them with the user identifier corresponding to the request, storing them in a pre-defined database. Specifically, each user identifier is associated with a GID and a UID. For example, user a has a GID of 2000 and a UID of 2000; user b has a GID of 3000 and a UID of 3000; and user c has a GID of 4000 and a UID of 5000. For the same user, the corresponding GID and UID may be the same or different. It should be noted that during the process of associating the retrieved GID and UID from the host machine with the user identifier corresponding to the request and storing them in the pre-defined database, other information required for creating container resources is also stored in the pre-defined database, such as environment variables required for creating the container group, the context security information of the container group to be created, and the number of containers included in the container group.
[0071] This embodiment obtains the GID and UID of the host machine corresponding to the container group after receiving the information creation request, and associates the obtained GID and UID of the host machine with the user identifier and stores them in the database. This allows the GID and UID of the host machine to be directly obtained from the preset database and added to the context security attributes of the container group to be created when creating container resources in the future, ensuring that the GID and UID in the host machine and the container group are consistent, and improving the creation efficiency of the container group.
[0072] Furthermore, methods for maintaining consistency between host machine and container group IDs also include:
[0073] Step b: Obtain the identity information of the user corresponding to the information creation request, and check whether the identity information passes the verification.
[0074] If the identity information is detected to pass the verification, then the step of associating the obtained GID and UID from the host machine with the user identifier corresponding to the information creation request and storing them in a preset database is executed.
[0075] Furthermore, upon receiving an information creation request for user information, the system obtains the identity information of the user corresponding to the information creation request and checks whether the identity information passes verification. In this embodiment, the identity information may be the username and password for logging into the container creation system. In other embodiments, the identity information may also include the user's ID card number and / or phone number, etc. If the identity information passes verification, the obtained GID and UID from the host machine are associated with the user identifier and stored in a preset database; if the user information fails verification, the obtained GID and UID from the host machine are not associated with the user identifier and stored in the preset database.
[0076] Further, step b includes:
[0077] Step b1: Obtain the username and password of the user corresponding to the information creation request, and check whether there is a preset username and a preset password in the user management system that are the same as the username and password.
[0078] Step b2: If a preset username with the same username as the user corresponding to the information creation request is detected in the user management system, and a preset password with the same password as the user is detected, then the identity information is determined to have passed the verification.
[0079] Specifically, the process of verifying identity information is as follows: The username and password of the user corresponding to the information creation request are obtained, and it is checked whether a preset username and password identical to the user's username and password exist in the user management system. If a preset username and password identical to the user's username and password are detected in the user management system, the identity information of the user corresponding to the information creation request is determined to have passed the verification by the user management system. If no preset username and password identical to the user's username and password exist in the user management system, the identity information of the user corresponding to the information creation request is determined to have failed the verification by the user management system. The user management system, or UM system for short, provides functions such as password management and permission verification for users. Understandably, when verifying identity information, the identity information of the user corresponding to the information creation request can be sent to the user management system. After receiving the identity information, the user management system checks whether its database stores the username and password. If the user management system's database stores the username and password, the user management system returns a first notification message indicating that the identity information has passed verification, to determine whether the identity information has passed verification based on the first notification message. If the user management system's database does not store the username and / or password, the user management system returns a second notification message indicating that the identity information has failed verification, to determine whether the identity information has failed verification based on the second notification message.
[0080] Furthermore, it should be noted that in the user management system, the username and password of the same user are stored together. Therefore, to improve the security of identity information, upon detecting the existence of a preset username and a preset password identical to the user's username and password in the user management system, the system checks whether there is a correlation between the preset username and password. If there is no correlation between the preset username and password, the identity information is determined to have failed verification; if there is a correlation between the preset username and password, the identity information is determined to have passed verification.
[0081] This embodiment improves the security of information stored in the preset database by checking whether the identity information of the user corresponding to the information creation request has passed the verification before storing the acquired GID and UID from the host machine in the preset database along with the user identifier. Only after the identity information has passed the verification will the acquired GID and UID from the host machine be stored in the preset database along with the user identifier.
[0082] Furthermore, methods for maintaining consistency between host machine and container group IDs also include:
[0083] Step c: Upon receiving a modification instruction to modify the GID and / or UID, modify the GID and / or UID stored in the preset database according to the modification instruction.
[0084] Furthermore, after the acquired GID and / or UID from the host machine are associated with the user identifier and stored in a preset database, the system checks whether a modification instruction to modify the GID and / or UID stored in the preset database has been received. If such an instruction is received, the system modifies the GID and / or UID stored in the preset database accordingly. This modification instruction can be triggered by the user as needed. Furthermore, if no modification instruction is received, the system continues to check for a modification instruction. Furthermore, the user can also trigger modification instructions to modify other data in the preset database besides the GID and UID.
[0085] This embodiment improves the operability of the preset database by providing users with the function of modifying the GID and UID stored in the preset database.
[0086] Furthermore, a third embodiment of the method for maintaining consistency between host machine and container group numbering according to the present invention is proposed.
[0087] The third embodiment of the method for maintaining consistency between host machine and container group numbers differs from the first or second embodiment in that step S10 includes:
[0088] Step d: Upon receiving a container creation request to create a container group, obtain the identity information of the user corresponding to the container creation request.
[0089] Step e: If the identity information of the user corresponding to the container creation request is verified, then the container group to be created is determined according to the container creation request, and the user identifier corresponding to the container group to be created is obtained.
[0090] Upon receiving a container creation request for a container group, the system retrieves the identity information of the user corresponding to the request and checks whether this information passes verification. The identity information of the user includes, but is not limited to, the username and password used to log in to the container creation system. It should be noted that the process for verifying the identity information of the user corresponding to the container creation request is the same as the process for verifying the identity information of the user who initially created the container, and will not be detailed here. If the identity information of the user corresponding to the container creation request passes verification, the system determines the container group to be created based on the container creation request and retrieves the user identifier corresponding to that container group. If the identity information of the user corresponding to the container creation request fails verification, the operations of determining the container group to be created based on the container creation request and retrieving the user identifier corresponding to that container group are prohibited.
[0091] This embodiment first checks whether the identity information of the user corresponding to the container creation request has passed verification after receiving the container creation request. Only after the identity information of the user corresponding to the container creation request has passed verification will the subsequent operations related to creating the container group be executed. This ensures that the user creating the container group is not an illegal user, thereby improving the security of the created container group and the security of the Kubernetes cluster.
[0092] In addition, refer to Figure 3 The present invention also provides an apparatus for maintaining consistency between the host machine and the container group number, the apparatus comprising:
[0093] The determination module 10 is used to determine the container group to be created based on the container creation request after receiving the container creation request.
[0094] The acquisition module 20 is used to acquire the user identifier corresponding to the container group to be created; and to acquire the group number GID and user number UID corresponding to the user identifier from a preset database, wherein the preset database stores the GID and UID of the host machine corresponding to the container group;
[0095] The module 30 is used to add the GID and UID to the context security attributes of the container group to be created, and obtain a container creation request carrying the GID and UID, so that the host GID and UID are consistent with the corresponding GID and UID in the container group to be created.
[0096] Furthermore, the determining module 10 is also used to determine the user identifier corresponding to the information creation request after receiving the information creation request for creating user information;
[0097] The acquisition module 20 is also used to acquire the GID and UID of the host machine corresponding to the container group;
[0098] The means for maintaining consistency between the host machine and container group numbers also includes:
[0099] The storage module is used to associate the acquired GID and UID from the host machine with the user identifier corresponding to the information creation request and store them in a preset database.
[0100] Furthermore, the acquisition module 20 is also used to acquire the identity information of the user corresponding to the information creation request;
[0101] The means for maintaining consistency between the host machine and container group numbers also includes:
[0102] The detection module is used to detect whether the identity information passes the verification.
[0103] The storage module is also used to associate the obtained GID and UID from the host machine with the user identifier corresponding to the information creation request and store them in a preset database if the identity information is detected to have passed the verification.
[0104] Furthermore, the acquisition module 20 is also used to acquire the username and password of the user corresponding to the information creation request;
[0105] The detection module is also used to detect whether there is a preset username that is the same as the username in the user management system, and whether there is a preset password that is the same as the user password.
[0106] The determining module 10 is further configured to determine that the identity information has passed verification if it detects that there is a preset username in the user management system that is the same as the username of the user corresponding to the information creation request, and a preset password that is the same as the password of the user.
[0107] Furthermore, the means for maintaining consistency between the host machine and container group numbers also includes:
[0108] The modification module is used to modify the GID and / or UID stored in the preset database according to the modification instruction when it receives a modification instruction to modify the GID and / or UID.
[0109] Furthermore, the determining module 10 includes:
[0110] The acquisition unit is used to acquire the identity information of the user corresponding to the container creation request after receiving a container creation request for creating a container group;
[0111] The determining unit is used to determine the container group to be created based on the container creation request if the identity information of the user corresponding to the container creation request is verified.
[0112] The means for maintaining consistency between the host machine and container group numbers includes:
[0113] The sending module is used to send a container creation request carrying the GID and UID to the K8s cluster, so that the K8s cluster can create the container group to be created according to the container creation request carrying the GID and UID.
[0114] It should be noted that the various embodiments of the apparatus for maintaining the consistency of host machine and container group numbers are basically the same as the various embodiments of the method for maintaining the consistency of host machine and container group numbers described above, and will not be described in detail here.
[0115] Furthermore, this invention also provides a device for maintaining consistency between the host machine and container group numbering. For example... Figure 4 As shown, Figure 4 This is a schematic diagram of the hardware operating environment involved in the embodiments of the present invention.
[0116] It should be noted that, Figure 4 This is a schematic diagram of the hardware operating environment for maintaining consistency between the host machine and container group numbers. In this embodiment of the invention, the device maintaining consistency between the host machine and container group numbers can be a PC, a portable computer, or other terminal device.
[0117] like Figure 4 As shown, the device that maintains the consistency between the host machine and the container group number may include: a processor 1001, such as a CPU; memory 1005; a user interface 1003; a network interface 1004; and a communication bus 1002. The communication bus 1002 is used to implement communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or stable non-volatile memory, such as disk storage. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0118] Optionally, devices that maintain consistency between the host machine and container group number may also include cameras, RF (Radio Frequency) circuits, sensors, audio circuits, WiFi modules, and so on.
[0119] Those skilled in the art will understand that Figure 4The device structure shown in the diagram for maintaining the consistency of host machine and container group numbers does not constitute a limitation on the device for maintaining the consistency of host machine and container group numbers. It may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0120] like Figure 4 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a program that maintains consistency between the host machine and container group numbers. The operating system is a program that manages and controls the device hardware and software resources that maintain consistency between the host machine and container group numbers, and supports the operation of the program that maintains consistency between the host machine and container group numbers, as well as other software or programs.
[0121] exist Figure 4 In the device shown for maintaining the consistency of host machine and container group numbers, user interface 1003 is mainly used for user management system and communicates data with user management system; network interface 1004 is mainly used for backend server and communicates data with backend server; processor 1001 can be used to call the program stored in memory 1005 for maintaining the consistency of host machine and container group numbers, and execute the steps of the method for maintaining the consistency of host machine and container group numbers as described above.
[0122] The specific implementation of the device for maintaining consistency between the host machine and container group numbering of the present invention is basically the same as the various embodiments of the method for maintaining consistency between the host machine and container group numbering described above, and will not be repeated here.
[0123] Furthermore, embodiments of the present invention also propose a computer-readable storage medium storing a program for maintaining consistency between the host machine and container group numbers. When the program for maintaining consistency between the host machine and container group numbers is executed by a processor, it implements the steps of the method for maintaining consistency between the host machine and container group numbers as described above.
[0124] The specific embodiments of the computer-readable storage medium of the present invention are basically the same as the embodiments of the method for maintaining consistency between host machine and container group numbering described above, and will not be repeated here.
[0125] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0126] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0127] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0128] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for maintaining host machine and container group numbering in agreement, the method comprising: The method for maintaining consistency between the host machine and the container group number comprises the following steps: After receiving a container creation request for creating a container group, identity information of a user corresponding to the container creation request is obtained; the container creation request carries a container group name of a to-be-created container group required to be created, context security attributes of a to-be-created container, and a user identifier of an operating user corresponding to the to-be-created container group; If it is detected that the identity information of the user corresponding to the container creation request passes verification, the to-be-created container group is determined according to the container group name carried in the container creation request, and the user identifier corresponding to the to-be-created container group is obtained; In a preset database, a group number GID and a user number UID corresponding to the user identifier are obtained, wherein the preset database stores the GID and the UID of the container group corresponding to the host machine; The GID and the UID are added to the context security attributes of the to-be-created container group, and a container creation request carrying the GID and the UID is obtained, so that the GID and the UID of the host machine are consistent with the corresponding GID and UID in the to-be-created container group.
2. The method of maintaining host and container group numbering in accordance with claim 1, wherein, Before the step of obtaining the identity information of the user corresponding to the container creation request after receiving the container creation request for creating a container group, the method further comprises the following steps: After receiving an information creation request for creating user information, a user identifier corresponding to the information creation request is determined; The GID and the UID in the host machine corresponding to the container group are obtained, and the obtained GID and UID in the host machine are stored in association with the user identifier corresponding to the information creation request in a preset database.
3. The method of maintaining host and container group numbering in accordance with claim 2, wherein, Before the step of storing the obtained GID and UID in the host machine in association with the user identifier corresponding to the information creation request in a preset database, the method further comprises the following steps: Identity information of the user corresponding to the information creation request is obtained, and it is detected whether the identity information passes verification; If it is detected that the identity information passes verification, the step of storing the obtained GID and UID in the host machine in association with the user identifier corresponding to the information creation request in a preset database is performed.
4. The method of maintaining host and container group numbering in accordance with claim 3, wherein, The step of obtaining the identity information of the user corresponding to the information creation request and detecting whether the identity information passes verification comprises the following steps: The username and the user password of the user corresponding to the information creation request are obtained, and it is detected whether there is a preset username same as the username in a user management system and whether there is a preset password same as the user password; If it is detected that there is a preset username same as the username of the user corresponding to the information creation request in the user management system and there is a preset password same as the user password, it is determined that the identity information passes verification.
5. The method of maintaining host and container group numbering in accordance with claim 2, wherein, After the step of obtaining the GID and the UID in the host machine corresponding to the container group, and storing the obtained GID and UID in the host machine in association with the user identifier corresponding to the information creation request in a preset database, the method further comprises the following steps: After receiving a modification instruction for modifying the GID and / or UID, the GID and / or UID stored in the preset database are modified according to the modification instruction.
6. The method of maintaining consistency of host machine and container group numbers according to any one of claims 1 to 5, wherein, The step of adding the GID and UID into the context security attribute of the container group to be created to obtain a container creation request carrying the GID and UID, so that the host GID and UID are consistent with the corresponding GID and UID in the container group to be created, further comprises: sending the container creation request carrying the GID and UID to a K8s cluster, so that a container cluster management system K8s cluster creates the container group to be created according to the container creation request carrying the GID and UID.
7. An apparatus for maintaining host machine and container group numbering in agreement, comprising: The device for maintaining consistency of host and container group numbers comprises: A determination module is configured to, after receiving a container creation request for creating a container group, acquire identity information of a user corresponding to the container creation request; the container creation request carries a container group name of a container group to be created, a context security attribute of a container to be created, and a user identifier of an operating user corresponding to the container group to be created; if it is detected that the identity information of the user corresponding to the container creation request passes verification, the container group to be created is determined according to the container group name carried by the container creation request, and the user identifier corresponding to the container group to be created is acquired; An acquisition module is configured to acquire the user identifier corresponding to the container group to be created, and acquire a group number GID and a user number UID corresponding to the user identifier in a preset database, wherein the preset database stores the GID and UID of a host corresponding to a container group; An adding module is configured to add the GID and UID into the context security attribute of the container group to be created to obtain a container creation request carrying the GID and UID, so that the host GID and UID are consistent with the corresponding GID and UID in the container group to be created.
8. The apparatus of claim 7 wherein the means for maintaining the host machine and container group numbers in agreement comprises: means for determining whether the host machine and container group numbers are in agreement; and means for updating the container group number if the host machine and container group numbers are not in agreement. The determination module is further configured to, after receiving an information creation request for creating user information, determine a user identifier corresponding to the information creation request; The acquisition module is further configured to acquire the GID and UID in a host corresponding to a container group; The device for maintaining consistency of host and container group numbers further comprises: A storage module is configured to store the acquired GID and UID in the host in association with the user identifier corresponding to the information creation request in a preset database.
9. The apparatus of claim 8 wherein the means for maintaining the host machine and container group numbers in agreement comprises: means for determining whether the host machine and container group numbers are in agreement; and means for updating the container group number if the host machine and container group numbers are not in agreement. The acquisition module is further configured to acquire identity information of a user corresponding to the information creation request; The device for maintaining consistency of host and container group numbers further comprises: A detection module is configured to detect whether the identity information passes verification; The storage module is further configured to, if it is detected that the identity information passes verification, store the acquired GID and UID in the host in association with the user identifier corresponding to the information creation request in a preset database.
10. The apparatus for maintaining consistency of host and container group numbers as set forth in claim 9, wherein, The acquisition module is further configured to acquire a username and a user password of a user corresponding to the information creation request; The detection module is further configured to detect whether a preset username identical to the username exists in a user management system, and whether a preset password identical to the user password exists; The detection module is further configured to detect whether a preset username identical to the username exists in a user management system, and whether a preset password identical to the user password exists; The determining module is further configured to determine that the identity information is verified if it is detected that there is a preset username same as a username of a user corresponding to the information creation request and a preset password same as a user password in the user management system.
11. The apparatus of claim 8 wherein the means for maintaining the host machine and container group numbers in agreement comprises: means for determining whether the host machine and container group numbers are in agreement; and means for updating the host machine and container group numbers to be in agreement. 5 The device for maintaining consistency between the host and the container group number further comprises: The modifying module is configured to modify the GID and / or UID stored in the preset database according to a modification instruction for modifying the GID and / or UID after receiving the modification instruction.
12. A device for maintaining consistency between host machine and container group numbering, characterized in that, The device for maintaining consistency between the host and the container group number comprises a memory, a processor, and a program for maintaining consistency between the host and the container group number stored in the memory and executable on the processor, and the program for maintaining consistency between the host and the container group number, when executed by the processor, implements the steps of the method for maintaining consistency between the host and the container group number according to any one of claims 1 to 6.
13. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a program for maintaining consistency between the host and the container group number, and the program for maintaining consistency between the host and the container group number, when executed by the processor, implements the steps of the method for maintaining consistency between the host and the container group number according to any one of claims 1 to 6.
Citation Information
Patent Citations
Applying host access control rules for data used in application containers
US20180247064A1