Remote command processing method and device, edge node, medium and product
By using Nsenter Pod on edge nodes in conjunction with the internal long-connection communication mechanism of Kubernetes and KubeEdge, the problem of SSH exposing usernames and passwords is solved, enabling efficient and secure remote command execution and improving the management efficiency and security of edge computing.
Patent Information
- Application Number
- CN202511705032.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-01-13
Smart Images

Figure CN121334221A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of remote control technology, and in particular relates to a remote command processing method, device, edge node, medium and product. Background Technology
[0002] Edge nodes are a key component of edge computing architecture. They are computing devices deployed at the edge of the network, located close to the data source or terminal device.
[0003] In related technologies, when executing remote commands on edge nodes, the Secure Shell (SSH) protocol is typically used to log in to the edge node, and then the corresponding commands are executed on the edge node. However, this process may expose information such as the username and password of the edge node, affecting the security of the edge node data. Summary of the Invention
[0004] This application provides a remote command processing method, apparatus, edge node, medium, and product that can solve the problem of poor data security at edge nodes.
[0005] In a first aspect, embodiments of this application provide a remote command processing method applied to an edge node, the edge node including an Nsenter Pod, the method comprising: Receive remote commands sent by users via the cloud; Execute remote commands through the Nsenter Pod and obtain the results of the remote command execution; Send the results of remote command execution to the user.
[0006] Secondly, embodiments of this application provide a remote command processing device applied to an edge node, the edge node including an Nsenter Pod, the device comprising: The receiving module is used to receive remote commands sent by users via the cloud; The execution module is used to execute remote commands through the Nsenter Pod and obtain the results of the remote command execution. The feedback module is used to send the results of remote command execution to the user.
[0007] Thirdly, embodiments of this application provide an edge node, including: a processor and a memory storing computer program instructions; the processor executes the computer program instructions to implement the steps of the remote command processing method provided in embodiments of this application.
[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the steps of the remote command processing method provided in embodiments of this application.
[0009] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by the processor of an edge node, cause the edge node to perform the steps of the remote command processing method provided in embodiments of this application.
[0010] In this embodiment, the edge node receives remote commands sent by the user via the cloud; executes the remote commands using an Nsenter Pod deployed on the edge node, obtains the execution result, and sends the result back to the user. This eliminates the need for SSH to execute remote commands, avoiding the exposure of the edge node's username and password, thus improving data security. Furthermore, the combination of Kubernetes, KubeEdge, and Nsenter tools enables remote connection to the edge node from the cloud and execution of remote commands, effectively improving the management efficiency of edge computing and ensuring the controllability and security of the edge nodes. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart illustrating the remote command processing method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the process for deploying an Nsenter Pod provided in an embodiment of this application; Figure 3 This is a schematic diagram illustrating the process of processing remote commands provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of the remote command processing device provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of the edge node provided in the embodiment of this application. Detailed Implementation
[0013] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0014] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0015] The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application. The terminology involved in the embodiments of this application is explained below.
[0016] Edge nodes are a key component of edge computing architecture. They are computing devices deployed at the edge of the network, located close to the data source or terminal device.
[0017] Kubernetes is an open-source container orchestration engine used to automate the deployment, scaling, and management of containerized applications.
[0018] Kubectl is a Kubernetes command-line tool used to operate Kubernetes clusters.
[0019] Kube-apiserver is the Kubernetes API server, responsible for handling RESTful API requests and forwarding them to the appropriate components.
[0020] Cloud Core is a cloud-based component in the Kube Edge cloud-native edge computing framework, responsible for communicating with the Kubernetes API server and managing edge nodes.
[0021] Edge Core is an edge component in KubeEdge, deployed on edge nodes, responsible for communicating with Cloud Core and executing corresponding commands.
[0022] Docker is a container runtime environment responsible for running containers on edge nodes.
[0023] An Nsenter Pod is a special Pod that uses an Alpine image and Nsenter tools to share the host machine's namespace, allowing the execution of system commands from the host machine.
[0024] The remote command processing method, apparatus, edge node, medium, and product provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0025] It should be noted that the remote command processing method and apparatus provided in this application can be executed by an edge node. Some embodiments of this application use an edge node as the execution subject to illustrate the remote command processing method provided in this application.
[0026] Figure 1 This is a flowchart illustrating a remote command processing method provided in some embodiments of this application. The remote command processing method may include: Step 101: Receive remote commands sent by the user via the cloud; In some embodiments of this application, the remote commands in these embodiments include, but are not limited to: viewing files in the root directory of the edge node, restarting the edge node, and shutting down the edge node.
[0027] In some embodiments of this application, step 101 may include: receiving a remote command sent by the cloud core through the edge core; wherein the remote command is sent by the user to the cloud core through the Kubectl tool.
[0028] In some embodiments of this application, Kube-apiserver and Cloud Core are deployed in the cloud; Edge Core and Nsenter Pod are deployed on the edge nodes.
[0029] Users use the Kubectl tool in the cloud to send remote commands to Cloud Core via Kube-apiserver, which need to be executed on edge nodes. Kube-apiserver locates the edge node where the Nsenter Pod resides and forwards the remote command to that edge node. Since Kube Edge generates iptables rules for that edge node, the remote command is ultimately forwarded to Cloud Core. After receiving the remote command from the user via Kubectl, Cloud Core parses it to determine the target edge node. Cloud Core then forwards the remote command to the Edge Core on the target edge node via an internal long-lived connection.
[0030] In this embodiment of the application, the internal long-connection communication mechanism of KubeEdge enables remote control of edge nodes from the cloud in a heterogeneous network environment.
[0031] In some embodiments of this application, prior to step 101, the remote control execution method provided in this application further includes: deploying an Nsenter Pod on an edge node.
[0032] In some embodiments of this application, users can deploy Nsenter Pods directly on edge nodes or remotely on edge nodes.
[0033] In some embodiments of this application, when deploying an Nsenter Pod on an edge node remotely, the edge core can receive an Nsenter Pod deployment command sent by the cloud core; wherein, the Nsenter Pod deployment command is sent by the user to the cloud core through the Kubectl tool; in response to the Nsenter Pod deployment command, Docker is invoked to deploy the Nsenter Pod on the edge node.
[0034] In some embodiments of this application, a user can create a Kubernetes YAML configuration file for deploying an Nsenter Pod. This configuration file defines the attributes and behaviors of the Nsenter Pod and executes it using Kubectl commands. The configuration file includes at least the following: a `nodeName` option, a `hostPID`, the namespace the Nsenter Pod enters, and the Nsenter Pod's running mode. Specifically, the `nodeName` option specifies the edge node from which the Nsenter Pod runs, and its value is the name of the edge node; `hostPID` allows the Nsenter Pod to share the edge node's PID information, and its value is `true`; the namespace the Nsenter Pod enters is the namespace on the edge node that the Nsenter Pod is allowed to access, and its value is the namespace of the edge node's root process; the running mode specifies the Nsenter Pod's running mode, and its value is privileged mode, allowing the Nsenter Pod to access the edge node's namespace.
[0035] After a user creates a Kubernetes YAML configuration file using the Kubectl command to specify the Nsenter Pod for the edge node, Kubectl calls the Kube-apiserver interface to create the Nsenter Pod on the specified edge node in the edge node cluster, essentially sending the Kubernetes YAML configuration file to Cloud Core. Upon receiving the Kubernetes YAML configuration file, Cloud Core instructs Edge Core to deploy the Nsenter Pod on the specified edge node, sending the Kubernetes YAML configuration file to the Edge Core on that edge node. Upon receiving the Kubernetes YAML configuration file, Edge Core calls Docker to deploy the Nsenter Pod on the edge node. The Nsenter Pod runs on the edge node and starts in privileged mode to access the edge node's namespace, thus enabling the execution of remote commands on the edge node. The deployment process for the Nsenter Pod is as follows: Figure 2 As shown, Figure 2 This is a schematic diagram illustrating the process of deploying an Nsenter Pod according to an embodiment of this application. The process of deploying an Nsenter Pod includes the following steps: Step 201: The user creates a Kubernetes yaml configuration file using the Kubectl command to specify the Nsenter Pod to the edge node; Step 202: Kubectl calls the Kube-apiserver interface to send the Kubernetes yaml configuration file to Cloud Core; Step 203: Cloud Core sends the Kubernetes yaml configuration file to the Edge Core on the specified edge node; Step 204: Edge Core calls Docker to deploy the Nsenter Pod on the edge node.
[0036] Step 102: Execute a remote command through the Nsenter Pod and obtain the result of the remote command execution; In some embodiments of this application, after receiving instructions from Cloud Core, Edge Core begins processing on the edge node. Edge Core sends remote commands to an Nsenter Pod via the Docker API, and the Nsenter Pod has sufficient permissions to enter the namespace of the edge node. The Nsenter Pod executes the remote command and obtains the result.
[0037] In some embodiments of this application, the Nsenter Pod and the edge node have a shared namespace, so remote commands are equivalent to being executed on the edge node.
[0038] Step 103: Send the results of the remote command execution to the user.
[0039] In some embodiments of this application, step 103 may include: sending the remote command execution result to the cloud core through the edge core, so that the cloud core can send the remote command execution result to the user.
[0040] In some embodiments of this application, after the Nsenter Pod executes a remote command and obtains the execution result, it sends the execution result to the Cloud Core via the Edge Core. The Cloud Core then returns the execution result to the user via the Kube-apiserver.
[0041] Figure 3 This is a schematic diagram illustrating the process of processing remote commands according to an embodiment of this application. The process of processing remote commands includes the following steps: Step 301: The user uses the Kubectl tool in the cloud to send remote commands that need to be executed on the edge node to Cloud Core through Kube-apiserver; Step 302: Cloud Core forwards remote commands to the Edge Core on the edge node through an internal long-connection communication mechanism; Step 303: Edge Core sends remote commands to the Nsenter Pod; Step 304: The Nsenter Pod executes a remote command, obtains the execution result, and sends the result to Cloud Core via Edge Core; Step 305: Cloud Core returns the results of the remote command execution to the user via Kube-apiserver.
[0042] The specific implementation process of each step in processing remote commands can be referred to the description in the above embodiments, and will not be repeated here in the embodiments of this application.
[0043] In this embodiment, the edge node receives remote commands sent by the user via the cloud; executes the remote commands using an Nsenter Pod deployed on the edge node, obtains the execution result, and sends the result back to the user. This eliminates the need for SSH to execute remote commands, avoiding the exposure of the edge node's username and password, thus improving data security. Furthermore, the combination of Kubernetes, KubeEdge, and Nsenter tools enables remote connection to the edge node from the cloud and execution of remote commands, effectively improving the management efficiency of edge computing and ensuring the controllability and security of the edge nodes.
[0044] This application also provides a remote command processing device, such as... Figure 4 As shown. Figure 4 This is a schematic diagram of the structure of the remote command processing device provided in the embodiments of this application. The remote command processing device 400 may include: The receiving module 401 is used to receive remote commands sent by the user through the cloud; Execution module 402 is used to execute remote commands through the Nsenter Pod and obtain the results of the remote command execution; Feedback module 403 is used to send the results of remote command execution to the user.
[0045] In some embodiments of this application, the receiving module 401 is specifically used for: The edge core receives remote commands sent by the cloud core; these remote commands are sent by the user to the cloud core via the Kubectl tool.
[0046] In some embodiments of this application, the feedback module 403 is specifically used for: The results of remote command execution are sent from the edge core to the cloud core, so that the cloud core can send the results of remote command execution to the user.
[0047] In some embodiments of this application, the remote command processing apparatus provided in this application further includes: The deployment module is used to deploy Nsenter Pods on edge nodes.
[0048] In some embodiments of this application, the deployment module is specifically used for: The edge core receives Nsenter Pod deployment commands sent by the cloud core; these Nsenter Pod deployment commands are sent by the user to the cloud core via the Kubectl tool. In response to the Nsenter Pod deployment command, Docker is invoked to deploy the Nsenter Pod on the edge node.
[0049] Figure 5 This is a schematic diagram of the structure of the edge node provided in the embodiment of this application.
[0050] The edge node 500 may include a processor 501 and a memory 502 storing computer program instructions.
[0051] Specifically, the processor 501 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0052] Memory 502 may include mass storage for data or instructions. For example, and not limitingly, memory 502 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 502 may include removable or non-removable (or fixed) media. Where appropriate, memory 502 may be internal or external to an edge node. In some specific embodiments, memory 502 is a non-volatile solid-state memory.
[0053] In some specific embodiments, the memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the remote command processing method according to this application.
[0054] The processor 501 reads and executes computer program instructions stored in the memory 502 to implement the remote command processing method provided in the embodiments of this application.
[0055] In one example, the edge node may also include a communication interface 503 and a bus 510. Wherein, as... Figure 5 As shown, the processor 501, memory 502, and communication interface 503 are connected through bus 510 and complete communication with each other.
[0056] The communication interface 503 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0057] Bus 510 includes hardware, software, or both, that couples components of an edge node together. For example, and not limited to, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 510 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.
[0058] The edge node can execute the remote command processing method provided in the embodiments of this application, thereby achieving the corresponding technical effects of the remote command processing method provided in the embodiments of this application.
[0059] In addition, in conjunction with the remote command processing method in the above embodiments, this application also provides a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement the remote command processing method provided in this application. Examples of computer-readable storage media include non-transitory computer-readable media, such as ROM, RAM, magnetic disks, or optical disks.
[0060] This application provides a computer program product. When the instructions in the computer program product are executed by the processor of an edge node, the edge node executes the remote command processing method provided in this application and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0061] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0062] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0063] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0064] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0065] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A remote command processing method, characterized in that, The method is applied to an edge node, the edge node including NsenterPod; the method includes: Receive remote commands sent by users via the cloud; The remote command is executed through the Nsenter Pod to obtain the execution result of the remote command; The result of the remote command execution is sent to the user.
2. The method according to claim 1, characterized in that, The receiving of remote commands sent by the user via the cloud includes: The remote command is received by the edge core from the cloud core; wherein the remote command is sent by the user to the cloud core through the Kubectl tool.
3. The method according to claim 1, characterized in that, Sending the result of the remote command execution to the user includes: The remote command execution result is sent to the cloud core through the edge core, so that the cloud core can send the remote command execution result to the user.
4. The method according to claim 1, characterized in that, Before receiving remote commands sent by the user via the cloud, the method further includes: Deploy the Nsenter Pod on the edge node.
5. The method according to claim 1, characterized in that, Deploying the NsenterPod on the edge node includes: The edge core receives Nsenter Pod deployment commands sent by the cloud core; wherein, the Nsenter Pod deployment commands are sent by the user to the cloud core via the Kubectl tool; In response to the Nsenter Pod deployment command, Docker is invoked to deploy the NsenterPod on the edge node.
6. A remote command processing device, characterized in that, The device is applied to an edge node, the edge node including an NsenterPod; the device includes: The receiving module is used to receive remote commands sent by users via the cloud; An execution module is used to execute the remote command through the Nsenter Pod and obtain the execution result of the remote command; The feedback module is used to send the execution result of the remote command to the user.
7. The apparatus according to claim 6, characterized in that, The receiving module is specifically used for: The remote command is received by the edge core from the cloud core; wherein the remote command is sent by the user to the cloud core through the Kubectl tool.
8. An edge node, characterized in that, The edge node includes: a processor and a memory storing computer program instructions; The processor reads and executes the computer program instructions to implement the remote command processing method as described in any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the remote command processing method as described in any one of claims 1-5.
10. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the edge node, the edge node performs the remote command processing method as described in any one of claims 1-5.