Container allocation, access method, information display method and container allocation system
By obtaining and sending the network access information of the target container in Kubernetes, the problem of container access requests drifting between nodes is solved, and fixed access is achieved for users.
Patent Information
- Application Number
- CN202211312135.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-25
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2042-10-25
AI Technical Summary
In Kubernetes, container access requests drift between nodes due to node load balancing, resulting in unstable user access.
By obtaining a container allocation request, the target container is determined and its network access information is obtained, and sent to the request initiator to fix access to the target container.
This enables users to access assigned target containers in a fixed manner, solving the problem of container access requests drifting between nodes.
Smart Images

Figure CN115904613B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of cloud computing technology, and in particular to a container allocation method, a container access method, an information display method, a container allocation system, a computing device, and a computer storage medium. Background Art
[0002] Kubernetes is a cloud-native technology used to automate the deployment, scaling, and management of containers. Kubernetes consists of multiple nodes, which are the smallest computing hardware units in Kubernetes. Each node provides applications with the computing and memory resources they need to run. In Kubernetes, one or more containers are deployed and run on a node.
[0003] In related technologies, Kubernetes usually provides services in the form of load balancing. Specifically, the container accessed by each container access request is determined by the current load of each node, causing the container access request initiated by the same user to drift between nodes. Summary of the Invention
[0004] Embodiments of the present invention provide a container allocation method, a container access method, an information display method, a container allocation system, a computing device, and a computer storage medium.
[0005] In a first aspect, an embodiment of the present invention provides a container allocation method, comprising:
[0006] Obtain the container allocation request sent by the request initiator;
[0007] In response to the container allocation request, determining a target container from at least one container;
[0008] Obtaining network access information of the target container from a database;
[0009] The network access information is sent to the request initiator, so that the request initiator accesses the target container based on the network access information.
[0010] In a second aspect, an embodiment of the present invention provides a container allocation method, comprising:
[0011] Get the network access information of the corresponding container;
[0012] The network access information is sent to a control node, so that the control node saves the network access information to a database, and after obtaining a container allocation request, determines a target container from at least one container; obtains the network access information of the target container from the database; and sends the network access information to a request initiator of the container allocation request, so that the request initiator accesses the target container based on the network access information.
[0013] In a third aspect, an embodiment of the present invention provides a container access method, including:
[0014] Get container access request;
[0015] In response to the container access request, obtaining network access information of the target container;
[0016] The container access request is sent to the target container according to the network access information.
[0017] In a fourth aspect, an embodiment of the present invention provides an information display method, including:
[0018] Get the container access request sent by the user;
[0019] In response to the container access request, obtaining network access information of the target container;
[0020] Sending the container access request to the target container according to the network access information;
[0021] receiving the data to be displayed sent by the target container;
[0022] The data to be displayed is sent to an information display device so that the information display device displays display information corresponding to the data to be displayed.
[0023] In a fifth aspect, an embodiment of the present invention provides a container dispensing device, comprising:
[0024] An allocation request acquisition module is used to acquire a container allocation request sent by a request initiator;
[0025] a target container determining module, configured to determine a target container from at least one container in response to the container allocation request;
[0026] A first access information acquisition module, configured to acquire network access information of the target container from a database;
[0027] The first information sending module is configured to send the network access information to the request initiator, so that the request initiator can access the target container based on the network access information.
[0028] In a sixth aspect, an embodiment of the present invention provides a container dispensing device, comprising:
[0029] A second access information acquisition module is used to obtain network access information of the corresponding container;
[0030] A second information sending module is configured to send the network access information to a control node, so that the control node saves the network access information to a database, and after obtaining a container allocation request, determine a target container from at least one container; obtain the network access information of the target container from the database; and send the network access information to a request initiator of the container allocation request, so that the request initiator can access the target container based on the network access information.
[0031] In a seventh aspect, an embodiment of the present invention provides a container access device, comprising:
[0032] A first access request obtaining module, configured to obtain a container access request;
[0033] a third access information acquisition module, configured to acquire network access information of a target container in response to the container access request;
[0034] A first access request sending module is configured to send the container access request to the target container according to the network access information.
[0035] In an eighth aspect, an embodiment of the present invention provides an information display device, including:
[0036] A second access request obtaining module, configured to obtain a container access request sent by a user;
[0037] a fourth access information acquisition module, configured to acquire network access information of a target container in response to the container access request;
[0038] a second access request sending module, configured to send the container access request to the target container according to the network access information;
[0039] A data receiving module, configured to receive the data to be displayed sent by the target container;
[0040] The data sending module is used to send the data to be displayed to the information display device so that the information display device displays the display information corresponding to the data to be displayed.
[0041] In a ninth aspect, an embodiment of the present invention further provides a container access system, including:
[0042] The sidecar container is used to obtain the network access information of the corresponding container and send the network access information to the control node;
[0043] A management and control node is configured to receive the network access information sent by the sidecar container and store the network access information in a database, so that when the management and control node obtains a container allocation request sent by a request initiator, it can determine a target container from at least one container, obtain the network access information of the target container from the database, and send the network access information to the request initiator, so that the request initiator can access the target container based on the network access information.
[0044] In a tenth aspect, an embodiment of the present invention provides a computing device, including a processing component and a storage component;
[0045] The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the container allocation method provided in the embodiment of the present invention, or to implement the container allocation method provided in the embodiment of the present invention, or to implement the information display method provided in the embodiment of the present invention.
[0046] In an eleventh aspect, an embodiment of the present invention provides a computer storage medium storing a computer program. When the computer program is executed by a computer, the container allocation method provided in the embodiment of the present invention is implemented, or the container allocation method provided in the embodiment of the present invention is implemented, or the information display method provided in the embodiment of the present invention is implemented.
[0047] The embodiments of the present invention adopt a technical solution in which, after allocating a target container to a request initiator in response to a container allocation request initiated by the request initiator, network access information of the target container is determined from a database and sent to the request initiator. This allows the request initiator to use the obtained network access information to consistently access the allocated target container after the target container is allocated to the request initiator, thereby resolving the technical issue of user-initiated container access requests drifting between nodes.
[0048] These and other aspects of the present invention will become more apparent from the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 The general architecture diagram of the container orchestration system Kubernetes is schematically shown;
[0051] Figure 2 A flowchart of a container dispensing method provided by one embodiment of the present invention is schematically shown;
[0052] Figure 3 A flow chart of a container dispensing method provided by another embodiment of the present invention is schematically shown;
[0053] Figure 4 A flowchart of a container access method provided by an embodiment of the present invention is schematically shown;
[0054] Figure 5 A flowchart of an information display method provided by another embodiment of the present invention is schematically shown;
[0055] Figure 6 A system block diagram schematically illustrates a system to which the container allocation method and container access method provided by the embodiments of the present invention can be applied;
[0056] Figure 7 A block diagram of a container dispensing device provided by one embodiment of the present invention is schematically shown;
[0057] Figure 8 A block diagram schematically shows a container dispensing device provided by another embodiment of the present invention;
[0058] Figure 9 A block diagram of a container access device provided by an embodiment of the present invention is schematically shown;
[0059] Figure 10 A block diagram schematically shows an information display device provided by another embodiment of the present invention;
[0060] Figure 11 The block diagram schematically shows a computing device provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0062] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or may be executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit "first" and "second" to be different types.
[0063] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.
[0064] Kubernetes, a container orchestration system, is a cloud-native technology used to automate the deployment, scaling, and management of containers. Kubernetes can consist of multiple nodes, which are the smallest computing hardware units in Kubernetes. Each node provides applications with the computing resources, memory resources, and other resources they need to run. In Kubernetes, one or more containers are deployed and run on a node.
[0065] In the process of implementing the concept of the present invention, the inventors discovered that in related technologies, Kubernetes usually provides services in the form of load balancing. Specifically, the container accessed by each container access request is determined by the current load of each node, resulting in container access requests initiated by the same user drifting between nodes.
[0066] Figure 1 The general architecture diagram of the container orchestration system Kubernetes is schematically shown.
[0067] like Figure 1As shown, Kubernetes divides the nodes in the cluster into a master node (Master) and at least one worker node (Node). The Master and Node can be physical machines or virtual machines in a cloud environment. The cloud environment is specifically a computing cluster that includes at least one cloud computing device (such as a central server). In some implementations, the Master and Node can also be physical machines or virtual machines in an edge environment. The edge environment is specifically a computing cluster that includes at least one edge computing device (such as an edge server). In other implementations, the Master and Node can also be end devices or virtual machines on end devices. It should be noted that the Master and Node can be physical machines or virtual machines in the same environment, or they can be physical machines or virtual machines in different environments. For example, the Master can be a physical machine in a cloud environment, and the Node can be a physical machine in an edge environment.
[0068] The Master runs a set of processes related to cluster management, such as the kube-apiserver, kube-controller-manager, kube-scheduler, and etcd. The kube-apiserver relies on etcd for data storage. These processes enable the Master to manage resources, pod scheduling, elastic scaling, security control, system monitoring, and error correction for the entire cluster.
[0069] Nodes run application processes, providing them with the resources they need to run. Application processes run in pod containers. Nodes also run service processes, such as the kubelet and kube-proxy proxy. Nodes use these service processes to create, start, monitor, restart, terminate, and load balance pods.
[0070] Figure 1 This example illustrates a Kubernetes cluster consisting of one Master and one Node. In some implementations, the Kubernetes cluster can include multiple Nodes, allowing applications to be deployed across them in a distributed manner. Furthermore, a Kubernetes cluster can also include multiple Masters. If one Master fails, another Master can be activated, ensuring high availability.
[0071] Figure 2The following schematically illustrates a flow chart of a container allocation method provided by an embodiment of the present invention. The container allocation method may be executed by a control node and includes the following steps:
[0072] 201, obtaining a container allocation request sent by a request initiator;
[0073] 202, in response to the container allocation request, determining a target container from at least one container;
[0074] 203, obtaining the network access information of the target container from the database;
[0075] 204 : Send the network access information to the request initiator, so that the request initiator can access the target container based on the network access information.
[0076] According to an embodiment of the present invention, the management and control node may include, for example, Figure 1 The master node (Master) shown in the figure is not limited to this. The master node can also include a node different from the master node (Master) in the container orchestration system. The control node is used to perceive the working status of the working nodes of the container orchestration system and the working status of the containers deployed in the working nodes, so as to allocate containers to users based on the working status of the working nodes and the working status of the containers deployed in the working nodes.
[0077] According to an embodiment of the present invention, the request initiator may, for example, include a client that needs to request access to a cloud application running in a container managed by the container orchestration system. The client may, for example, include a set-top box, a mobile phone, a tablet computer, a personal computer, etc.; the cloud application may, for example, include a video playback application, a cloud gaming application, etc.
[0078] According to an embodiment of the present invention, cloud applications can actually run in containers deployed on worker nodes managed by a container orchestration system. The worker nodes provide computing and storage resources for the operation of cloud applications. Clients can stream cloud applications to the client for user use by accessing the container running the cloud application. Therefore, before a client accesses a container, it can first send a container allocation request to the master node so that the worker node can allocate a container for the client.
[0079] According to embodiments of the present invention, in actual application scenarios, a container orchestration system typically manages a large number of worker nodes, each of which has a large number of containers deployed. Therefore, upon receiving a container allocation request, the master node can determine a target container for the client from among the multiple containers it manages. The target container may include one or more containers.
[0080] According to an embodiment of the present invention, the master node can obtain the network access information of multiple containers it manages in advance and store the network access information in the storage (etcd). The network access information can be used to uniquely determine the access method of the corresponding container.
[0081] According to an embodiment of the present invention, after determining the target container for the client, the network access information corresponding to the target container can be determined from multiple candidate network access information pre-stored in the memory (etcd). Specifically, the memory (etcd) can associate and store the container identifier of at least one container with its corresponding candidate network access information in a data table, so that after determining the target container, the target container identifier of the target container can be first obtained, and then the target container identifier can be traversed and matched with multiple container identifiers stored in the data table until a container identifier corresponding to the target container identifier is matched, and then the network access information corresponding to the target container can be determined based on the association relationship between the container identifier and the candidate network access information.
[0082] According to an embodiment of the present invention, after determining the network access information of the target container, the network access information of the target container allocated to the client can be sent to the client, so that the client can access the target container based on the access method of the target container indicated by the network access information.
[0083] In an embodiment of the present invention, after allocating a target container to a request initiator in response to a container allocation request initiated by the request initiator, a technical solution is adopted in which network access information of the target container is determined from a database and sent to the request initiator. This allows the request initiator to use the obtained network access information to consistently access the allocated target container after the target container is allocated to the request initiator, thereby resolving the technical issue of user-initiated container access requests drifting between nodes.
[0084] According to an embodiment of the present invention, the container allocation request carries the user identifier of the request initiator.
[0085] The container allocation method further includes: creating a corresponding relationship between the target container and the request initiator, so as to authenticate the request initiator based on the user identifier of the request initiator.
[0086] In one embodiment of the present invention, after creating a correspondence between the target container and the request initiator, the correspondence can be stored in a memory (etcd). Accordingly, a container access request from the client can be first sent to the master node. After receiving the container access request requesting access to the target container, the master node can first retrieve the correspondence between the target container and the request initiator pre-stored in the memory (etcd) based on the user identifier of the request initiator to determine whether the request initiator has access rights to the target container. If the request initiator has access rights to the target container, the container access request can be forwarded to the target container; if the request initiator does not have access rights to the target container, the container access request of the request initiator can be rejected.
[0087] In another embodiment of the present invention, after establishing a correspondence between a target container and a request initiator, the correspondence can be sent to the corresponding target container, causing the target container to store the correspondence. Accordingly, container access requests from the client can be directly sent to the target container, allowing the target container to authenticate the container access request based on the pre-stored correspondence.
[0088] According to an embodiment of the present invention, after allocating a target container to a request initiator, the target container is switched from a stateless container to a stateful container by obtaining network access information of the target container and sending the network access information to the request initiator, and associating the user identifier of the request initiator with the request initiator, so that the target container can be exclusively accessed by the request initiator.
[0089] According to an embodiment of the present invention, the container allocation method further includes:
[0090] Obtain a container deployment request, where the container deployment request is used to request deployment of at least one container;
[0091] Deploy at least one container to the corresponding node;
[0092] Obtain the access address of the node corresponding to at least one container and the network port on at least one node respectively;
[0093] The access address and network port are saved as the network access information of the container to the database.
[0094] According to an embodiment of the present invention, when a container is deployed to a corresponding node, a corresponding sidecar container can be deployed for the container in the node. The sidecar container can be used to monitor the running status of the corresponding container and determine the network access information of the container.
[0095] According to an embodiment of the present invention, the network access information may include an access address of the node and a network port allocated to the container on the node.
[0096] According to an embodiment of the present invention, after determining the network access information of the container, the sidecar container may send the network access information to the control node so that the control node stores the network access information.
[0097] According to an embodiment of the present invention, after determining the network access information of the container, the sidecar container can attach the network access information to the corresponding container, and after the corresponding container is started, send the network access information to the management and control node.
[0098] According to an embodiment of the present invention, deploying at least one container to a corresponding node may be specifically implemented as follows:
[0099] determining a container density configured for each of the at least one nodes;
[0100] According to the container density of each node, at least one container is deployed to the corresponding node.
[0101] According to an embodiment of the present invention, container density may be used to represent the number of containers deployable on a node.
[0102] According to an embodiment of the present invention, the container density of each node may be pre-configured by the management and control node.
[0103] According to an embodiment of the present invention, a management and control node can pre-assign a node label to each node. The node label is used to characterize the container density of the node. After the node label is configured, an affinity for the node label can be configured for at least one container based on the container density configured for each node. This affinity can then be used to deploy the container to the corresponding node.
[0104] For example, there are nodes A, B, and C, where the node label of node A indicates that the container density of node A is 3, the node label of node B indicates that the container density of node B is 4, and the node label of node C indicates that the container density of node C is 3. For 10 containers to be allocated, based on the container densities of nodes A, B, and C, affinity can be configured for 3 of the containers with the node label of node A, affinity can be configured for 4 containers with the node label of node B, and affinity can be configured for 3 containers with the node label of node C. Thus, based on the node density, the 10 containers can be evenly deployed to nodes A, B, and C.
[0105] According to an embodiment of the present invention, by configuring the container density for each node, the number of containers that can be deployed on each node can be fixed, and when deploying the containers, a certain number of containers can be deployed to the corresponding nodes using node affinity, thereby avoiding the floating of containers between the nodes and balancing the load of each node.
[0106] According to an embodiment of the present invention, determining a target container from at least one container may be specifically implemented as follows:
[0107] Monitor the working status of the node corresponding to at least one container and obtain node status information;
[0108] Get the lifecycle events of a container deployed on at least one node;
[0109] A target container is determined from at least one container according to the node status information and the lifecycle event.
[0110] According to an embodiment of the present invention, since the container is deployed in the node, the node provides computing resources and storage resources for the operation of the container. Therefore, the working status of the node will affect whether the container deployed therein can work normally. Therefore, when determining the target container, the working status of the node can be monitored first to obtain the working status information of the node.
[0111] According to embodiments of the present invention, node operating status information may include, for example, normal operation and abnormalities. When a node's operating status is abnormal, the normal operation of the containers deployed there will also be affected. Therefore, it is possible to restrict containers deployed on abnormally operating nodes, for example by setting the containers to an unallocatable state. Furthermore, abnormality prompt information can be generated based on the abnormally operating nodes and output to operations and maintenance personnel, allowing them to promptly perform maintenance on the abnormally operating nodes.
[0112] According to an embodiment of the present invention, the lifecycle events of a container may include, for example, started, allocated, destroyed, and the like.
[0113] According to an embodiment of the present invention, determining a target container from at least one container based on node status information and lifecycle events may be specifically implemented as follows:
[0114] screening at least one node based on the node status information to determine at least one candidate node in a working state;
[0115] screening at least one candidate node based on lifecycle events of containers deployed in the candidate nodes to determine at least one target node on which a container in a started and unassigned state is deployed;
[0116] A target container is determined from at least one target node.
[0117] According to an embodiment of the present invention, a two-step screening process can be performed when determining a target container. Specifically, first, based on the node's operating status information, at least one candidate node that can operate normally can be screened out from at least one node. Second, based on the lifecycle events of the containers deployed on the at least one candidate node, containers in the destroyed or allocated states can be excluded. This allows at least one target node deployed with a container in the started and unallocated state to be determined from the at least one candidate node. For at least one target node, after screening, all are in normal operating condition and deployed with a container in the started and unallocated state. Therefore, a container can be randomly determined from the at least one target node as the target container.
[0118] According to an embodiment of the present invention, by respectively determining the working status of the node and the life cycle events of the container, and determining the target container based on the working status of the node and the life cycle events of the container when allocating the container, the management and control node has dynamic scheduling capabilities when allocating the container.
[0119] Figure 3 The following schematically illustrates a flow chart of a container allocation method provided by another embodiment of the present invention. The container allocation method can be executed by a sidecar container and may include the following steps:
[0120] 301, obtain the network access information of the corresponding container;
[0121] 302. Send the network access information to the control node, so that the control node saves the network access information to a database, and after obtaining the container allocation request, determines a target container from at least one container; obtains the network access information of the target container from the database; and sends the network access information to the request initiator of the container allocation request, so that the request initiator can access the target container based on the network access information.
[0122] According to an embodiment of the present invention, when a container is deployed to a corresponding node, a corresponding sidecar container can be deployed for the container in the node. The sidecar container can be used to monitor the running status of the corresponding container and determine the network access information of the container.
[0123] According to an embodiment of the present invention, the network access information may include an access address of the node and a network port allocated to the container on the node.
[0124] According to an embodiment of the present invention, after determining the network access information of the container, the sidecar container may send the network access information to the control node so that the control node stores the network access information.
[0125] According to an embodiment of the present invention, after determining the network access information of the container, the sidecar container can attach the network access information to the corresponding container, and after the corresponding container is started, send the network access information to the management and control node.
[0126] After the control node obtains the network access information, the container allocation operation and Figure 2 The container dispensing method shown is the same or similar and will not be described in detail here.
[0127] Figure 4 A flowchart of a container access method provided by an embodiment of the present invention is schematically shown. The container solution method can be executed by a client and may include the following steps:
[0128] 401, Get container access request;
[0129] 402. Respond to the container access request and obtain network access information of the target container.
[0130] 403. Send the container access request to the target container based on the network access information.
[0131] According to an embodiment of the present invention, a user may perform corresponding operations on a client to trigger a container access request. For example, when a user opens a client and confirms that the user desires to run a cloud application running in a container, it may be determined that the user has triggered a container access request.
[0132] According to one embodiment of the present invention, in response to a container access request, network access information of a pre-allocated target container may be obtained from a local storage of a client.
[0133] According to another embodiment of the present invention, when network access information is not available in the client's local storage, the client can send a container allocation request to the control node. The control node can then respond to the container allocation request, determine a target container from at least one container, obtain network access information for the target container from a database, and send the network access information to the client. After obtaining the network access information, the client can store the network access information in the local storage, so that when accessing the target container in the future, the network access information can be directly obtained from the local storage.
[0134] According to an embodiment of the present invention, the network access information may include, for example, an access address of a node where the target container is deployed, and a network port on the node used for communicating with the target container.
[0135] While implementing the present invention, the inventors discovered that the broadcasting and television industry has a large inventory of older set-top boxes. Due to performance limitations, these older boxes cannot be installed with smart set-top box applications, limiting the content coverage of broadcasting and television operator clients. To achieve content coverage, smart set-top box applications can be run in the cloud and streamed to the set-top boxes, allowing users to use smart set-top box applications even with older boxes.
[0136] Smart set-top box applications are cloud applications that run in cloud containers. Because different users have different usage habits and requirements for smart set-top box applications, it is usually necessary to bind smart set-top box applications to users so that users can have fixed access to the corresponding smart set-top box applications.
[0137] Containers are typically managed by Kubernetes, a cloud-native container orchestration system used to automate the deployment, scaling, and management of containers. Kubernetes can include multiple nodes, the smallest computing hardware unit in Kubernetes. Each node provides applications with the computing and memory resources they need to run. In Kubernetes, one or more containers are deployed and run on a node.
[0138] However, Kubernetes usually provides services in the form of load balancing. Specifically, the container accessed by each container access request is determined by the current load of each node, causing container access requests initiated by the same user to drift between nodes.
[0139] Figure 5 A flowchart of an information display method provided by another embodiment of the present invention is schematically shown. The container access method can be executed by a set-top box and may include the following steps:
[0140] 501, obtain the container access request sent by the user;
[0141] 502. Responding to the container access request, obtaining network access information of the target container;
[0142] 503. Send the container access request to the target container based on the network access information.
[0143] 504, receiving the data to be displayed sent by the target container;
[0144] 505 , sending the data to be displayed to the information display device so that the information display device displays display information corresponding to the data to be displayed.
[0145] According to an embodiment of the present invention, the target container may include, for example, an Android container.
[0146] According to an embodiment of the present invention, a user may perform a corresponding operation on a set-top box to trigger a container access request. For example, when a user turns on the set-top box and confirms that the user desires to run a cloud application running in a container, it may be determined that the user has triggered a container access request.
[0147] According to one embodiment of the present invention, in response to a container access request, network access information of a pre-allocated target container may be obtained from a local memory of the set-top box.
[0148] According to another embodiment of the present invention, when network access information is not available in the local memory of the set-top box, the set-top box may send a container allocation request to the control node. The control node, in response to the container allocation request, determines a target container from at least one container, obtains network access information for the target container from a database, and sends the network access information to the set-top box. After obtaining the network access information, the set-top box may store the network access information in the local memory, so that when accessing the target container in the future, the network access information can be directly obtained from the local memory.
[0149] According to an embodiment of the present invention, the network access information may include, for example, an access address of a node where the target container is deployed, and a network port on the node used for communicating with the target container.
[0150] According to an embodiment of the present invention, when accessing a container, the network access information is used so that the set-top box can fixedly access the target container pointed to by the network access information.
[0151] According to an embodiment of the present invention, the information display device may include, for example, a television, a monitor, etc. After the set-top box obtains the data to be displayed returned by the target container, it may directly send the data to be displayed to the information display device so that the information display device can render and display the data to be displayed.
[0152] An embodiment of the present invention further provides a container access system, including:
[0153] The sidecar container is used to obtain the network access information of the corresponding container and send the network access information to the control node;
[0154] The control node is used to receive the network access information sent by the sidecar container and store the network access in the database, so that when the control node obtains the container allocation request sent by the request initiator, it can determine the target container from at least one container, obtain the network access information of the target container from the database, and send the network access information to the request initiator, so that the request initiator can access the target container based on the network access information.
[0155] Figure 6The system block diagram schematically shows a system block diagram to which the container allocation method and the container access method provided by the embodiments of the present invention can be applied.
[0156] exist Figure 6 In the figure, 601 can represent the client, 602 can represent the control node, 603 and 604 can represent the working nodes, 6031 can represent the container deployed in the working node 603, 6032 can be the sidecar container corresponding to the container 6031, 6041 can represent the container deployed in the working node 604, and 6042 can be the sidecar container corresponding to the container 6041.
[0157] like Figure 6 As shown, when the control node deploys container 6031 and container 6041 on working node 603 and working node 604 respectively, it can deploy sidecar container 6032 and sidecar container 6042 corresponding to container 6031 and container 6041 respectively.
[0158] The sidecar container 6032 and the sidecar container 6042 can respectively obtain the network access information of the corresponding containers, and send the network access information to the control node 602 respectively, so that the control node stores the network access information of the container 6031 and the container 6032. The network access information may, for example, include the access address of the node and the network port on the node used to communicate with the container.
[0159] Client 601 can send a container allocation request to control node 602. After receiving the container allocation request, control node 602 can determine a target container from containers 6031 and 6032. For example, the target container can be 6031. The control node can then obtain pre-stored network access information for target container 6031 and send the network access information to client 601.
[0160] After receiving the network access information of the target container 6031, the client 601 can store the network access information in the local storage. When the client 601 receives the container access request sent by the user, it can first obtain the pre-stored network access information from the local storage and use it to access the target container pointed to by the network access information, thereby achieving exclusive and fixed access to the target container.
[0161] Figure 7 A block diagram of a container allocation device provided by an embodiment of the present invention is schematically shown. The container allocation device 700 may include an allocation request acquisition module 701 , a target container determination module 702 , a first access information acquisition module 703 , and a first information sending module 704 .
[0162] Allocation request acquisition module 701, used to acquire the container allocation request sent by the request initiator;
[0163] a target container determining module 702, configured to determine a target container from at least one container in response to a container allocation request;
[0164] A first access information acquisition module 703 is used to obtain network access information of a target container from a database;
[0165] The first information sending module 704 is configured to send the network access information to the request initiator, so that the request initiator can access the target container based on the network access information.
[0166] According to an embodiment of the present invention, the container allocation request carries the user identifier of the request initiator.
[0167] According to an embodiment of the present invention, the container dispensing device 700 further includes:
[0168] The relationship creation module is used to create a corresponding relationship between the target container and the request initiator, so as to authenticate the request initiator based on the user identifier of the request initiator.
[0169] According to an embodiment of the present invention, the container dispensing device 700 further includes:
[0170] A deployment request acquisition module is used to obtain a container deployment request, where the container deployment request is used to request deployment of at least one container;
[0171] A container deployment module, configured to deploy at least one container to a corresponding node;
[0172] An information acquisition module, configured to respectively acquire an access address of a node corresponding to at least one container and a network port on at least one node;
[0173] The access information determination module is used to save the access address and network port as the network access information of the container to the database.
[0174] According to an embodiment of the present invention, the container deployment module includes:
[0175] A container density determination submodule, configured to determine a container density configured for at least one node;
[0176] The container deployment module is used to deploy at least one container to the corresponding node according to the container density of each node.
[0177] According to an embodiment of the present invention, the container deployment module includes:
[0178] A monitoring unit, configured to monitor the working status of each node corresponding to at least one container and obtain node status information;
[0179] An event acquisition unit, configured to acquire lifecycle events of a container deployed on at least one node;
[0180] The target container determining unit is configured to determine a target container from at least one container according to the node status information and the lifecycle event.
[0181] According to an embodiment of the present invention, the target container determination unit includes:
[0182] a first screening subunit, configured to screen at least one node based on the node status information to determine at least one candidate node in a working state;
[0183] a second screening subunit, configured to screen at least one candidate node based on lifecycle events of containers deployed in the candidate nodes, to determine at least one target node on which a container in a started and unassigned state is deployed;
[0184] The target container determination subunit is configured to determine a target container from at least one target node.
[0185] Figure 7 The container dispensing device can perform Figure 2 The implementation principle and technical effects of the container dispensing method of the embodiment shown are not described in detail here. The specific manner in which each module and unit performs operations in the container dispensing device of the above embodiment has been described in detail in the embodiment of the method, and will not be elaborated on here.
[0186] Figure 8 A block diagram of a container dispensing device provided by another embodiment of the present invention is schematically shown. The container dispensing device 800 may include a second access information obtaining module 801 and a second information sending module 802 .
[0187] The second access information acquisition module 801 is used to obtain network access information of the corresponding container;
[0188] The second information sending module 802 is configured to send the network access information to the control node, so that the control node saves the network access information to a database, and after obtaining a container allocation request, determines a target container from at least one container; obtains the network access information of the target container from the database; and sends the network access information to the request initiator of the container allocation request, so that the request initiator can access the target container based on the network access information.
[0189] Figure 8 The container dispensing device can perform Figure 3The implementation principle and technical effects of the container dispensing method of the embodiment shown are not described in detail here. The specific manner in which each module and unit performs operations in the container dispensing device of the above embodiment has been described in detail in the embodiment of the method, and will not be elaborated on here.
[0190] Figure 9 A block diagram of a container access device provided by an embodiment of the present invention is schematically shown. The container access device may include a first access request obtaining module 901 , a third access information obtaining module 902 , and a first access request sending module 903 .
[0191] A first access request obtaining module 901 is configured to obtain a container access request;
[0192] A third access information acquisition module 902 is configured to acquire network access information of a target container in response to a container access request;
[0193] The first access request sending module 903 is configured to send a container access request to a target container according to the network access information.
[0194] Figure 9 The container access device can execute Figure 4 The implementation principles and technical effects of the container access method in the illustrated embodiment will not be elaborated on here. The specific manner in which the various modules and units in the container access device in the above embodiment perform operations has been described in detail in the embodiments of the method and will not be elaborated on here.
[0195] Figure 10 A block diagram of an information display device provided by another embodiment of the present invention is schematically shown. The container access device 1000 may include a second access request acquisition module 1001, a fourth access information acquisition module 1002, a second access request sending module 1003, a data receiving module 1004, and a data sending module 1005.
[0196] A second access request obtaining module 1001 is configured to obtain a container access request sent by a user;
[0197] A fourth access information acquisition module 1002 is configured to acquire network access information of a target container in response to a container access request;
[0198] A second access request sending module 1003 is configured to send a container access request to a target container based on the network access information;
[0199] The data receiving module 1004 is used to receive the data to be displayed sent by the target container;
[0200] The data sending module 1005 is used to send the data to be displayed to the information display device so that the information display device displays the display information corresponding to the data to be displayed.
[0201] Figure 10 The container access device can execute Figure 5 The implementation principle and technical effects of the information display method of the illustrated embodiment will not be elaborated here. The specific manner in which each module and unit performs operations in the container access device of the above embodiment has been described in detail in the embodiment of the method and will not be elaborated here.
[0202] In one possible design, the container access device, container allocation device, and information display device provided in the embodiment of the present invention can be implemented as a computing device, such as Figure 11 As shown, the computing device may include a storage component 1101 and a processing component 1102;
[0203] The storage component 1101 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component 1102 to implement the container allocation method, container access method, and information display method provided in the embodiments of the present invention.
[0204] Of course, a computing device may also include other components, such as input / output interfaces and communication components. The input / output interface provides an interface between the processing component and peripheral interface modules, such as output devices and input devices. The communication component is configured to facilitate wired or wireless communication between the computing device and other devices.
[0205] Among them, the computing device can be a physical device or an elastic computing host provided by a cloud computing platform, etc. In this case, the computing device can refer to a cloud server, and the above-mentioned processing components, storage components, etc. can be basic server resources rented or purchased from the cloud computing platform.
[0206] When the computing device is a physical device, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device.
[0207] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a computer, the container allocation method, container access method, and information display method provided in the embodiment of the present invention can be implemented.
[0208] An embodiment of the present invention further provides a computer program product, including a computer program. When the computer program is executed by a computer, the container allocation method, the container access method, and the information display method provided in the embodiment of the present invention can be implemented.
[0209] The processing components in the above embodiments may include one or more processors to execute computer instructions to complete all or part of the steps in the above methods. Of course, the processing components may also be implemented as one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0210] The memory component is configured to store various types of data to support operations in the device. The memory component can be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0211] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0212] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0213] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0214] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A container dispensing method, characterized in that: include: Obtain the container allocation request sent by the request initiator; In response to the container allocation request, obtaining network access information of a pre-allocated target container from a local memory of the request initiator; If the network access information is not obtained in the local storage of the request initiator, determining a target container from at least one container; Obtaining network access information of the target container from a database; Sending the network access information to the request initiator, so that the request initiator accesses the target container based on the network access information; The request initiator stores the network access information in a local memory so that when accessing the target container later, the network access information can be directly obtained from the local memory; Determining the target container from at least one container includes: Monitor the working status of the nodes corresponding to the at least one container and obtain node status information; Get the lifecycle events of a container deployed on at least one node; A target container is determined from at least one container according to the node status information and the lifecycle event.
2. The method according to claim 1, characterized in that The container allocation request carries the user identifier of the request initiator; the method further includes: A correspondence between the target container and the request initiator is created to authenticate the request initiator based on the user identifier of the request initiator.
3. The method according to claim 1, characterized in that The method further comprises: Obtaining a container deployment request, where the container deployment request is used to request deployment of at least one container; Deploy the at least one container to the corresponding node respectively; Obtaining the access address of the node corresponding to the at least one container and the network port on at least one of the nodes respectively; The access address and the network port are saved in a database as network access information of the container.
4. The method according to claim 1, wherein Determining a target container from at least one container according to the node status information and the lifecycle event includes: screening the at least one node based on the node status information to determine at least one candidate node in a working state; Screening the at least one candidate node based on lifecycle events of containers deployed in the candidate nodes to determine at least one target node on which a container in a started and unassigned state is deployed; The target container is determined from the at least one target node.
5. A container dispensing method, characterized in that: include: Get the network access information of the corresponding container; The network access information is sent to a control node so that the control node saves the network access information to a database and, after obtaining a container allocation request, determines a target container from at least one container; obtains the network access information of the target container from the database; the network access information is sent to a request initiator of the container allocation request so that the request initiator accesses the target container based on the network access information; the request initiator stores the network access information in a local memory so that the network access information can be directly obtained from the local memory when subsequently accessing the target container; Determining the target container from at least one container includes: Monitor the working status of the nodes corresponding to the at least one container and obtain node status information; Get the lifecycle events of a container deployed on at least one node; A target container is determined from at least one container according to the node status information and the lifecycle event.
6. A container access method, characterized in that: include: Get container access request; In response to the container access request, obtaining network access information of the target container; Sending the container access request to the target container according to the network access information; In response to the container access request, obtaining network access information of the target container includes: Obtaining network access information of a pre-allocated target container from a local storage of the request initiator; If the network access information is not obtained in the local storage of the request initiator, determining a target container from at least one container and obtaining the network access information of the target container; Determining the target container from at least one container includes: Monitor the working status of the nodes corresponding to the at least one container and obtain node status information; Get the lifecycle events of a container deployed on at least one node; A target container is determined from at least one container according to the node status information and the lifecycle event.
7. An information display method, characterized in that: Applied to set-top boxes, including: Get the container access request sent by the user; In response to the container access request, obtaining network access information of the target container; Sending the container access request to the target container according to the network access information; receiving the data to be displayed sent by the target container; Sending the data to be displayed to an information display device so that the information display device displays display information corresponding to the data to be displayed; The obtaining, in response to the container access request, network access information of the target container includes: Obtaining network access information of a pre-allocated target container from a local storage of the request initiator; If the network access information is not obtained in the local storage of the request initiator, determining a target container from at least one container and obtaining the network access information of the target container; Determining the target container from at least one container includes: Monitor the working status of the nodes corresponding to the at least one container and obtain node status information; Get the lifecycle events of a container deployed on at least one node; A target container is determined from at least one container according to the node status information and the lifecycle event.
8. A container dispensing system, characterized in that: include: The sidecar container is used to obtain the network access information of the corresponding container and send the network access information to the control node; a control node, configured to receive the network access information sent by the sidecar container and store the network access information in a database, so that when the control node obtains a container allocation request sent by a request initiator, it can determine a target container from at least one container, obtain the network access information of the target container from the database, and send the network access information to the request initiator, so that the request initiator can access the target container based on the network access information; Determining the target container from at least one container includes: Monitor the working status of the nodes corresponding to the at least one container and obtain node status information; Get the lifecycle events of a container deployed on at least one node; A target container is determined from at least one container according to the node status information and the lifecycle event.
9. A computing device, characterized in that including processing components and storage components; The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the container allocation method according to any one of claims 1 to 4, or the container allocation method according to claim 5, or the container access method according to claim 6, or the information display method according to claim 7.
10. A computer storage medium, characterized in that A computer program is stored, and when the computer executes the computer program, the container allocation method according to any one of claims 1 to 4 is implemented, or the container allocation method according to claim 5 is implemented, or the container access method according to claim 6 is implemented, or the information display method according to claim 7 is implemented.
Citation Information
Patent Citations
Task processing method, device, apparatus and system and storage medium
CN112130983A
Container scheduling method and system, equipment and storage medium
CN113760452A