A method and system for securely deploying AI agents in a Kubernetes environment
Patent Information
- Application Number
- CN202610857668.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-10-09
AI Technical Summary
[0007]为解决上述技术问题,本发明提供一种在Kubernetes环境中安全部署AI智能体的方法及系统,用以解决传统技术中AI智能体本地部署或简单容器化部署存在凭证泄露和文件系统破坏的问题
[0026]与传统技术相比,本发明的有益效果在于:一种在Kubernetes环境中安全部署AI智能体的方法及系统中智能体主容器通过边车代理容器获取外部应用数据,并基于覆盖文件系统容器的容器可写层进行数据处理操作,将数据运行结果保存至独立存储空间;上述技术方案通过边车代理容器实现了凭证的零暴露,基于覆盖文件系统容器的容器可写层进行数据处理操作,实现了与文件系统的隔离,将数据运行结果保存至独立存储空间,实现了存储隔离,显著降低了凭证泄露和文件破坏的风险,避免了敏感信息在智能体主容器内明文形式的存储,消除了破坏传播与跨用户的污染,为智能体主容器中部署AI智能体提供了企业级的安全沙箱,适用于安全性要求较高的企业生产环境,实现AI智能体在多租户、分布式集群中的安全和可控部署。
Smart Images

Figure CN122884596A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of cloud computing and AI agent technology, and in particular to a method and system for securely deploying AI agents in a Kubernetes environment. Background Technology
[0003] As the popularity of open-source AI agents continues to rise, their ability to directly control terminals, browsers, and emails via natural language commands has greatly enhanced the practicality of AI. However, the default high system privileges and weak security configurations bring serious security risks. For example, malicious commands can be used to leak sensitive information (such as API keys and social credentials) or corrupt the global file system (such as deleting critical files or tampering with cross-user data).
[0004] Currently, AI agents are mostly deployed on local standalone machines or in simple containers, running with high privileges on the host machine or simple container by default, directly accessing external APIs and file systems. During task processing, hard-coded credentials or exposed environment variables can easily lead to data leaks, further causing unrestricted write operations to the file system that could corrupt host machine or cross-container data. These issues not only amplify the attack surface, leading to data theft or illegal transactions, but also easily cause cross-contamination of privacy in multi-user enterprise scenarios, limiting the application and promotion of AI agents in enterprise production environments.
[0005] Therefore, a method and system for securely deploying AI agents in a Kubernetes environment are proposed. Summary of the Invention
[0007] To address the aforementioned technical problems, this invention provides a method and system for securely deploying AI agents in a Kubernetes environment, thereby resolving the issues of credential leakage and file system corruption that arise from local or simple containerized deployment of AI agents in traditional technologies.
[0008] This invention provides a method for securely deploying AI agents in a Kubernetes environment, comprising: Deploy the AI agent main container, the sidecar proxy container, and the overlay file system container on the smallest deployment unit of Kubernetes; the AI agent main container is used to deploy the AI agent; the overlay file system container includes a container writable layer and an image read-only layer. The sidecar agent container receives data requests sent by the main intelligent agent container, performs source verification, injects credentials into the data request, and obtains external application data by connecting to the external application interface. The main intelligent agent container reads external application data from the sidecar proxy container through a reserved loopback address; The main container of the intelligent agent performs data processing operations based on the external application data and the writable layer of the overlay file system container, obtains the data processing results, and saves them to an independent storage space.
[0009] In some optional implementations, the steps of: the sidecar proxy container receiving a data request sent by the intelligent agent main container, performing source verification, injecting credentials into the data request, and obtaining external application data by connecting to an external application programming interface; include: The sidecar proxy container is equipped with a credential injection module, a local proxy server, and an authentication verifier. The authentication verifier receives the data request transmitted by the main container of the intelligent agent, verifies the source of the request, and after the verification is successful, transmits the data request to the local proxy server. The credential injection module extracts the API key from the sensitive information database in Kubernetes and transmits it to the local proxy server. The local proxy server connects to the external application interface based on the API key, injects credentials into the data request, and obtains external application data through the external application interface.
[0010] In some optional implementations, the step of: the authentication verifier receiving a data request transmitted by the main container of the intelligent agent, verifying the source of the request, and, after successful verification, transmitting the data request to the local proxy server; includes: The data request is parsed to obtain the container identity token and container permission role; The authentication verifier checks the identity legitimacy and access permissions of the main intelligent container based on the container identity token and container permission role. After the detection is passed, the external access address of the data request is obtained, and the compliance of the external access address is checked. If the external access traffic compliance check is passed, the data request is transmitted to the local proxy server; if the external access traffic compliance check is not passed, an error instruction code is returned to the local proxy server.
[0011] In some optional implementations, the step of: the main intelligent agent container performing data processing operations based on the external application data and the writable layer of the overlay file system container, obtaining the data processing results, and saving them to an independent storage space; includes: According to the task requirements, the main container of the intelligent agent generates an internal data request and obtains the internal data based on the read-only layer of the image of the overlay file system container.
[0012] In some alternative implementations, the AI agents that can be deployed in the main agent container include OpenClaw, AutoGPT, and ChatDev.
[0013] In some optional implementations, the step of deploying the agent master container, the sidecar proxy container, and the overlay file system container on the smallest deployment unit of Kubernetes; the overlay file system container includes a container writable layer and an image read-only layer; including: In Kubernetes, the control plane receives task requests from the client via the ingress gateway. The control plane performs identity verification and task authorization on the user terminal and the task requirements. After the detection is successful, it assigns the corresponding work node to the task requirements. The working node sets up a minimum deployment unit according to the task requirements, and deploys the intelligent agent main container, the sidecar proxy container, and the overlay file system container on the minimum deployment unit.
[0014] In some optional implementations, the step of: the worker node setting up a minimum deployment unit according to the task requirements, and deploying the agent main container, the sidecar proxy container, and the overlay file system container on the minimum deployment unit; includes: A monitoring node is set up within the working node to monitor the resource usage of the minimum deployment unit and its contents in real time, and transmit the node resource usage information to the control plane. The control plane stores the node resource usage information transmitted by the monitoring nodes in the time-series database; Based on the load prediction algorithm, the future resource usage of the working node is predicted according to the current resource usage of the node. Based on the current resource usage of the nodes and the future resource usage of the working nodes, the resources of the working nodes are adjusted and scheduled for the smallest deployment unit.
[0015] In some optional implementations, the step of: predicting the future resource usage of the worker node based on the node resource usage using a load prediction algorithm; includes: Obtain the node resource usage status ; ;
[0016] in, This refers to the node resource usage. For working nodes Processor utilization at any given moment For working nodes Memory usage at any given time For working nodes Disk utilization at any given time Within the working node Container utilization at any given time; The node's resource usage is calculated using an anomaly detection algorithm. Abnormal score ;include: Obtain the node resource usage at different times and construct sample nodes; The node resource usage Input, calculate the resource usage of the node. The height of each node in the sample nodes is used to calculate the anomaly score based on the average path length of the sample nodes. ;
[0017] in, Node resource usage The average height of each node in the sample nodes, This represents the average path length of the sample nodes. The node resource occupancy information is input into a first temporal convolutional network to obtain a predicted normal load situation; the abnormal score and the node resource occupancy information are input into a second temporal convolutional network to obtain a predicted extreme load situation; the abnormal score and the node resource occupancy information are input into a classification network to obtain a predicted classification probability. Based on the predicted classification probability, predicted normal load conditions, and predicted extreme load conditions, calculate the future resource usage. ;
[0018] in, For future resource usage, To predict the probability of the first category being the normal load in the future, To predict normal load conditions, To predict the probability of a second category with an extreme load in the future, To predict extreme load conditions.
[0019] In some optional implementations, the step of: controlling the working node to adjust resource scheduling for the minimum deployment unit based on the node resource occupancy and the future resource occupancy of the working node; includes: Based on the preset deployment of the smallest deployment unit in the working node, and according to the node resource usage and the future resource usage, the total processor utilization of the working node to execute the task is calculated. ;
[0020] in, For the first The predicted processor utilization of each minimum deployment unit, with a total of preset values. A minimum deployment unit is used to process the task request. Total processor utilization for all minimum deployment units; Set the scaling threshold for the minimum deployment unit; ;
[0021] ;
[0022] in, This is the reduction threshold. For expansion threshold, Minimum processor utilization for the smallest deployment unit. Highest processor utilization for the smallest deployment unit; Execute the corresponding scaling strategy for the minimum deployment unit based on the scaling threshold and the total processor utilization. ;
[0023] in, The number of units to be optimized for the smallest deployment unit. The rounding up symbol, The floor symbol is used for rounding down. To take the sign of the maximum value, The minimum standard number of units required for deployment; Based on the available resources and optimization adjustment quantity of all minimum deployment units, set the optimal adjustment quantity of the minimum deployment unit; ;
[0024] in, The optimal number of adjustments for the smallest deployment unit. To take the sign of the minimum value, This represents the available resources of the smallest deployment unit under the default deployment configuration. The maximum amount of available resources for each smallest deployment unit.
[0025] This invention provides a system for securely deploying AI agents in a Kubernetes environment, comprising: The container deployment module is used to deploy the main agent container, the sidecar proxy container, and the overlay file system container on the smallest deployment unit of Kubernetes; the overlay file system container includes a container writable layer and an image read-only layer. The data request module is used to receive data requests sent by the main intelligent agent container through the sidecar proxy container, perform source verification, inject credentials into the data request, and obtain external application data by connecting to the external application interface; the main intelligent agent container reads the external application data from the sidecar proxy container through a reserved loopback address; The data processing module is used by the main container of the intelligent agent to perform data processing operations based on the external application data and the container writable layer of the overlay file system container, obtain the data processing results, and save them to an independent storage space.
[0026] Compared with traditional technologies, the beneficial effects of this invention are as follows: A method and system for securely deploying AI agents in a Kubernetes environment allows the main agent container to obtain external application data through a sidecar proxy container and perform data processing operations based on a container writable layer that overlays the file system container, saving the data processing results to an independent storage space. This technical solution achieves zero exposure of credentials through the sidecar proxy container, isolates data processing operations from the file system by performing data processing operations based on a container writable layer that overlays the file system container, and achieves storage isolation by saving the data processing results to an independent storage space. This significantly reduces the risk of credential leakage and file corruption, avoids the storage of sensitive information in plaintext within the main agent container, eliminates the spread of damage and cross-user contamination, and provides an enterprise-level security sandbox for deploying AI agents in the main agent container. It is suitable for enterprise production environments with high security requirements, enabling secure and controllable deployment of AI agents in multi-tenant, distributed clusters.
[0027] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.
[0028] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0030] Figure 1 This is a flowchart illustrating the method for securely deploying AI agents in a Kubernetes environment provided by the present invention. Figure 2 This is a schematic diagram of the system for securely deploying AI agents in a Kubernetes environment, as provided by the present invention. Detailed Implementation
[0032] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0033] This invention provides a method for securely deploying AI agents in a Kubernetes environment, with reference to... Figure 1 ,include: S1. Deploy the main agent container, sidecar proxy container, and overlay file system container on the smallest deployment unit of Kubernetes; the main agent container is used to deploy the AI agent; the overlay file system container includes a container writable layer and an image read-only layer; S2. The sidecar agent container receives data requests sent by the main intelligent agent container, performs source verification, injects credentials into the data request, and obtains external application data by connecting to the external application interface. S3. The main container of the intelligent agent reads external application data from the sidecar agent container through the reserved loopback address; S4. The main container of the intelligent agent performs data processing operations based on the external application data and the container writable layer that covers the file system container, obtains the data processing results, and saves them to an independent storage space.
[0034] In this embodiment of the invention, the main agent container, the sidecar proxy container, and the overlay file system container are deployed on the smallest deployment unit Pod in Kubernetes.
[0035] In this embodiment of the invention, the Sidecar proxy container receives a data request sent by the main agent container. The Sidecar proxy container connects to an external application interface and obtains the corresponding external application data according to the data request. The main agent container reads the external application data from the Sidecar proxy container through a reserved loopback address (127.0.0.1). The main agent container performs data processing operations based on the external application data and the container writable layer that overlays the file system container, obtains the data processing results, and saves them to an independent storage space.
[0036] In this embodiment of the invention, the sidecar proxy container and the smart agent main container share the localhost network.
[0037] In this embodiment of the invention, the overlay file system container is implemented as an overlay file system.
[0038] In this embodiment of the invention, Kubernetes is a standard open-source container orchestration and scheduling platform in the cloud-native field, used to manage containerized workloads and services, facilitating declarative configuration and automation.
[0039] In this embodiment of the invention, the main intelligent agent container obtains external application data through the sidecar proxy container and performs data processing operations based on the container writable layer that overlays the file system container, saving the data processing results to an independent storage space. The above method achieves zero exposure of credentials through the sidecar proxy container, performs data processing operations based on the container writable layer that overlays the file system container to achieve isolation from the file system, and saves the data processing results to an independent storage space to achieve storage isolation. This significantly reduces the risk of credential leakage and file corruption, avoids the storage of sensitive information in plaintext form within the main intelligent agent container, eliminates the spread of damage and cross-user pollution, and provides an enterprise-level security sandbox for deploying AI agents in the main intelligent agent container. It is suitable for enterprise production environments with high security requirements and enables secure and controllable deployment of AI agents in multi-tenant, distributed clusters.
[0040] In this embodiment of the invention, step S2: The sidecar proxy container receives a data request sent by the main intelligent agent container, performs source verification, injects credentials into the data request, and obtains external application data by connecting to an external application interface; including: The sidecar proxy container deploys a credential injection module, a local proxy server, and an authentication verifier; The authentication verifier receives data requests transmitted by the main container of the intelligent agent, verifies the source of the request, and transmits the data request to the local proxy server after the verification is successful. The credential injection module extracts the API key from the sensitive information repository in Kubernetes and transmits it to the local proxy server. The local proxy server connects to the external application interface based on the API key, injects credentials into the data request, and obtains external application data through the external application interface.
[0041] In this embodiment of the invention, the authentication verifier in the sidecar proxy container receives the data request transmitted by the main intelligent agent container and verifies the source of the request. After the verification is successful, the data request is transmitted to the local proxy server. The credential injection module extracts the API key from the sensitive information database (Secret) in Kubernetes and transmits it to the local proxy server.
[0042] In this embodiment of the invention, the local proxy server connects to the external application interface based on the API key, injects credentials into the data request, and obtains external application data through the external application interface.
[0043] In this embodiment of the invention, credentials are injected into the data request, such as an Authorization header.
[0044] In this embodiment of the invention, the local proxy server can be proxied via a local HTTP or SOCKS proxy.
[0045] In this embodiment of the invention, when the main container of the intelligent agent needs to obtain external application data according to task requirements, it obtains the data by connecting to the external application interface through the sidecar proxy container, thereby avoiding the risk of credential exposure and improving the security of deploying AI intelligent agents in the Kubernetes environment.
[0046] In this embodiment of the invention, the steps are as follows: the authentication verifier receives a data request transmitted by the main container of the intelligent agent, verifies the source of the request, and after the verification is successful, transmits the data request to the local proxy server; including: Parse the data request to obtain the container identity token and container permission roles; The authentication verifier checks the identity legitimacy and access permissions of the main container of the intelligent agent based on the container identity token and container permission role; After the detection is passed, the external access address of the data request is obtained, and the compliance of the external access address is checked. If the external access traffic compliance check is passed, the data request is transmitted to the local proxy server; if the external access traffic compliance check is not passed, an error instruction code is returned to the local proxy server.
[0047] In this embodiment of the invention, when the authentication verifier receives a data request, it checks the container identity token and the container permission role. The container identity token is a JWT (JSON Web Token) token, which includes an algorithm identifier, data information and a tamper-proof signature. The authentication verifier verifies the identity and legitimacy of the main intelligent agent container by key verification. The container permission role detection detects that the main intelligent agent container has the permission to access external application data and communicate with the local proxy server.
[0048] In this embodiment of the invention, the compliance of the external access traffic of the data request external access address is checked. If the external access traffic compliance check is passed, the data request is transmitted to the local proxy server to perform the next step; if the external access traffic compliance check is not passed, an error instruction code is returned to the local proxy server.
[0049] In this embodiment of the invention, the compliance check of external access traffic can be implemented as the network address that the administrator allows to access.
[0050] In this embodiment of the invention, the authentication verifier obtains the container identity token and container permission role through parsing, thereby detecting the identity legitimacy and access permissions of the main container of the intelligent agent, preventing unauthorized containers from accessing the local proxy server, and performing compliance checks on the external access address of data requests to obtain the corresponding external application data, effectively ensuring the security of external network access.
[0051] In this embodiment of the invention, step S4: The main container of the intelligent agent performs data processing operations based on external application data and a container writable layer that overlays the file system container, obtains the data processing results, and saves them to an independent storage space; including: Based on the task requirements, the main container of the intelligent agent generates an internal data request and obtains the internal data based on the read-only layer of the image of the overlay file system container.
[0052] In this embodiment of the invention, when internal data needs to be obtained according to task requirements, the main container of the intelligent agent generates an internal data request based on the read-only layer of the image covering the file system container.
[0053] In this embodiment of the invention, when the main container of the intelligent agent needs to obtain internal data, it reads it by overwriting the file system container to avoid damaging the underlying files.
[0054] In this embodiment of the invention, the AI agents that can be deployed in the main agent container include OpenClaw, AutoGPT, and ChatDev.
[0055] In this embodiment of the invention, one or more autonomous agents may be deployed in the main container of the intelligent agent.
[0056] In this embodiment of the invention, step S1: Deploy the intelligent agent main container, the sidecar proxy container, and the overlay file system container on the smallest deployment unit of Kubernetes; the overlay file system container includes a container writable layer and an image read-only layer; including: In Kubernetes, the control plane receives task requests from the client via the ingress gateway. The control plane authenticates and authorizes user clients and task requirements, and assigns corresponding work nodes to task requirements after the detection is passed. Work nodes are configured with a minimum deployment unit based on task requirements, and the agent main container, sidecar proxy container, and overlay file system container are deployed on the minimum deployment unit.
[0057] In this embodiment of the invention, the control plane receives task requirements transmitted by the user terminal through the entry gateway. After the user terminal and task requirements are authenticated and the task is authorized, the task requirements are assigned to the corresponding work nodes for processing. The work nodes set up a minimum deployment unit according to the task requirements, and deploy the intelligent agent main container, the side vehicle proxy container, and the overlay file system container on the minimum deployment unit.
[0058] In this embodiment of the invention, user access is achieved through the control plane in Kubernetes. After the user and task requirements are authenticated and authorized, the deployment of the smallest deployment unit and its containers is achieved according to the task requirements.
[0059] In this embodiment of the invention, the steps are as follows: The worker node sets up a minimum deployment unit according to task requirements, and deploys the intelligent agent main container, the sidecar proxy container, and the overlay file system container on the minimum deployment unit; including: Set up monitoring nodes within the working nodes to monitor the resource usage of the minimum deployment unit and its contents in real time, and transmit the node resource usage information to the control plane. The control plane stores the node resource usage information transmitted by the monitoring nodes in the time-series database; Based on the load prediction algorithm, the future resource usage of worker nodes is predicted according to the current resource usage of nodes. Based on the current resource usage of nodes and the future resource usage of worker nodes, control the worker nodes to adjust resource scheduling for the smallest deployment unit.
[0060] In this embodiment of the invention, a monitoring node (cAdvisor tool) is set up to monitor the resource usage of the minimum deployment unit and its contents, and the data is stored in a time-series database (InfluxDB database). The future resource usage of the worker nodes is predicted based on a load prediction algorithm. Based on the node resource usage and the future resource usage, the worker nodes are controlled to adjust the resource scheduling of the minimum deployment unit.
[0061] In this embodiment of the invention, online monitoring of key resource indicators of working nodes is achieved through monitoring nodes, and the resource requirements of the smallest deployment unit in the future period are predicted through a load prediction algorithm. Then, the resources of the smallest deployment unit are adjusted and scheduled to meet the processing of task requirements, ensure timely response to load changes, and maintain efficient processing of tasks.
[0062] In this embodiment of the invention, the step of: predicting the future resource usage of worker nodes based on the node resource usage using a load prediction algorithm; includes: Get node resource usage ; ;
[0063] in, This refers to the node resource usage. For working nodes Processor utilization at any given moment For working nodes Memory usage at any given time For working nodes Disk utilization at any given time Within the working node Container utilization at any given time; Node resource usage is calculated using an anomaly detection algorithm. Abnormal score ;include: Obtain the node resource usage at different times and construct sample nodes; Node resource usage Input: Compute node resource usage The height of each node in the sample nodes is calculated, and the anomaly score is calculated based on the average path length of the sample nodes. ;
[0064] in, Node resource usage The average height of each node in the sample nodes. This represents the average path length of the sample nodes. Input the node resource usage data into the first temporal convolutional network to obtain the predicted normal load; input the outlier scores and node resource usage data into the second temporal convolutional network to obtain the predicted extreme load; input the outlier scores and node resource usage data into the classification network to obtain the predicted classification probability. Calculate future resource usage based on predicted classification probabilities, predicted normal load conditions, and predicted extreme load conditions; ;
[0065] in, For future resource usage, To predict the probability of the first category being the normal load in the future, To predict normal load conditions, To predict the probability of a second category with an extreme load in the future, To predict extreme load conditions.
[0066] In this embodiment of the invention, node resource occupancy is obtained; anomaly scores are calculated based on anomaly detection algorithms; the node resource occupancy is input into a first temporal convolutional network to obtain predicted normal load conditions; the anomaly scores and node resource occupancy are input into a second temporal convolutional network to obtain predicted extreme load conditions; the anomaly scores and node resource occupancy are input into a classification network to obtain predicted classification probabilities; and a weighted calculation is performed based on the predicted classification probabilities, predicted normal load conditions, and predicted extreme load conditions to obtain future resource occupancy.
[0067] In this embodiment of the invention, the node resource usage includes the processor utilization, memory utilization, disk utilization, and container utilization of the worker node at various times.
[0068] In this embodiment of the invention, the anomaly detection algorithm can adopt the isolated forest algorithm, which treats sample nodes as isolated trees, constructs an isolated forest based on the node resource occupancy, inputs the node resource occupancy, calculates the height of the node resource occupancy in each isolated tree, and calculates the anomaly score based on the average path length of the sample nodes.
[0069] In this embodiment of the invention, the first temporal convolutional network and the second temporal convolutional network can be implemented as a temporal convolutional network (TCN). The first temporal convolutional network predicts the normal load situation, and the second temporal convolutional network predicts the extreme load situation. The two situations are distinguished based on the classification network, and the future resource occupancy is obtained by weighted integration of the prediction of the normal load situation and the prediction of the extreme load situation.
[0070] In this embodiment of the invention, the load prediction model constructed by the first temporal convolutional network, the second temporal convolutional network and the classification network can adaptively predict extreme loads and normal loads, thereby achieving efficient adaptation to various task requirements and having high prediction accuracy. This solves the problem that traditional models cannot handle abnormal data, which leads to the inability to effectively predict extreme loads, and thus provides a reliable basis for container resource scheduling and decision-making.
[0071] In this embodiment of the invention, the step of: controlling the resource scheduling adjustment of the worker nodes to the smallest deployment unit based on the node resource occupancy status and the future resource occupancy status of the worker nodes; includes: Based on the preset deployment of the smallest deployment unit in the worker node, the total processor utilization required for the worker node to execute tasks is calculated according to the node resource usage and future resource usage. ;
[0072] in, For the first The predicted processor utilization of each minimum deployment unit, with a total of preset values. A minimum deployment unit is used to process task requests. Total processor utilization for all minimum deployment units; Set the scaling threshold for the minimum deployment unit; ;
[0073] ;
[0074] in, This is the reduction threshold. For expansion threshold, Minimum processor utilization for the smallest deployment unit. Highest processor utilization for the smallest deployment unit; Execute the corresponding scaling strategy for the smallest deployment unit based on the scaling threshold and total processor utilization. ;
[0075] in, The number of units to be optimized for the smallest deployment unit. The rounding up symbol, The floor symbol is used for rounding down. To take the sign of the maximum value, The minimum standard number of units required for deployment; Based on the available resources and optimization adjustments of all minimum deployment units, set the optimal number of adjustments for each minimum deployment unit; ;
[0076] in, The optimal number of adjustments for the smallest deployment unit. To take the sign of the minimum value, This represents the available resources of the smallest deployment unit under the default deployment configuration. The maximum amount of available resources for each smallest deployment unit.
[0077] In this embodiment of the invention, the total processor utilization required for the execution of tasks by the work node is calculated based on the preset deployment status of the smallest deployment unit in the work node, the node resource occupancy status, and the future resource occupancy status. The smallest deployment unit in the work node is expanded or shrunk by setting the expansion / shrinkage threshold of the smallest deployment unit.
[0078] In this embodiment of the invention, the scaling threshold is set based on the minimum processor utilization of the minimum deployment unit, the maximum processor utilization, and the preset number of minimum deployment units.
[0079] In this embodiment of the invention, the total processor utilization is compared with the scaling-up / scaling threshold. When the total processor utilization is greater than the scaling-up threshold, the minimum deployment unit scaling-up strategy is executed. When the total processor utilization is less than the scaling-down threshold, the minimum deployment unit scaling-down strategy is executed to obtain the optimized adjustment number of the minimum deployment unit.
[0080] In this embodiment of the invention, when the optimal adjustment quantity of the minimum deployment unit is obtained, the available resources of the minimum deployment unit are analyzed, a deployment strategy with a smaller number of minimum deployment units is selected, and the optimal adjustment quantity is obtained to perform resource scheduling adjustment on the minimum deployment unit.
[0081] In this embodiment of the invention, based on the predicted future resource usage, the total processor utilization required for executing tasks in the future is calculated. Based on the comparison between the total processor utilization and the scaling threshold, the corresponding scaling strategy is executed on the smallest deployment unit to dynamically adjust the allocation of resources, ensuring that the working nodes can maintain a high response quality when processing task requirements, so as to guarantee high reliability and processing efficiency in processing task requirements.
[0082] This invention provides a system for securely deploying AI agents in a Kubernetes environment, with reference to... Figure 2 ,include: Container deployment module 21 is used to deploy the agent main container, sidecar proxy container, and overlay file system container on the smallest deployment unit of Kubernetes; the overlay file system container includes a container writable layer and an image read-only layer; The data request module 22 is used to receive data requests sent by the main intelligent agent container through the sidecar proxy container, perform source verification, inject credentials into the data request, and obtain external application data by connecting to the external application interface; the main intelligent agent container reads the external application data from the sidecar proxy container through the reserved loopback address; The data processing module 23 is used by the main container of the intelligent agent to perform data processing operations based on external application data and the container writable layer that covers the file system container, obtain the data processing results, and save them to an independent storage space.
[0083] In this embodiment of the invention, the container deployment module 21 deploys the main intelligent agent container, the sidecar proxy container, and the overlay file system container on the smallest deployment unit Pod of Kubernetes.
[0084] In this embodiment of the invention, the data request module 22 receives the data request sent by the main agent container through the sidecar proxy container. The sidecar proxy container connects to the external application interface and obtains the corresponding external application data according to the data request. The main agent container reads the external application data from the sidecar proxy container through the reserved loopback address (127.0.0.1). The data processing module 23 performs data processing operations on the main agent container based on the external application data and the container writable layer covering the file system container, obtains the data processing results, and saves them to an independent storage space.
[0085] In this embodiment of the invention, the main intelligent agent container obtains external application data through the sidecar proxy container and performs data processing operations based on the container writable layer that overlays the file system container, saving the data processing results to an independent storage space. The above system achieves zero exposure of credentials through the sidecar proxy container, performs data processing operations based on the container writable layer that overlays the file system container, achieves isolation from the file system, and saves the data processing results to an independent storage space, achieving storage isolation. This significantly reduces the risk of credential leakage and file corruption, avoids the storage of sensitive information in plaintext form within the main intelligent agent container, eliminates the spread of damage and cross-user pollution, and provides an enterprise-level security sandbox for deploying AI agents in the main intelligent agent container. It is suitable for enterprise production environments with high security requirements and enables secure and controllable deployment of AI agents in multi-tenant, distributed clusters.
[0086] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for securely deploying AI agents in a Kubernetes environment, characterized in that, include: Deploy the agent main container, sidecar proxy container, and overlay file system container on the smallest deployment unit of Kubernetes; The main container for the AI agent is used to deploy the AI agent; the overlay file system container includes a writable layer and a read-only layer for the image. The sidecar agent container receives data requests sent by the main intelligent agent container, performs source verification, injects credentials into the data request, and obtains external application data by connecting to the external application interface. The main intelligent agent container reads external application data from the sidecar proxy container through a reserved loopback address; The main container of the intelligent agent performs data processing operations based on the external application data and the writable layer of the overlay file system container, obtains the data processing results, and saves them to an independent storage space.
2. The method for securely deploying AI agents in a Kubernetes environment according to claim 1, characterized in that, The steps are as follows: The sidecar proxy container receives the data request sent by the main intelligent agent container, performs source verification, injects credentials into the data request, and obtains external application data by connecting to the external application interface; including: The sidecar proxy container is equipped with a credential injection module, a local proxy server, and an authentication verifier. The authentication verifier receives the data request transmitted by the main container of the intelligent agent, verifies the source of the request, and after the verification is successful, transmits the data request to the local proxy server. The credential injection module extracts the API key from the sensitive information database in Kubernetes and transmits it to the local proxy server. The local proxy server connects to the external application interface based on the API key, injects credentials into the data request, and obtains external application data through the external application interface.
3. The method for securely deploying AI agents in a Kubernetes environment according to claim 2, characterized in that, The steps are as follows: The authentication verifier receives the data request transmitted by the main container of the intelligent agent, verifies the source of the request, and after successful verification, transmits the data request to the local proxy server; including: The data request is parsed to obtain the container identity token and container permission role; The authentication verifier checks the identity legitimacy and access permissions of the main intelligent container based on the container identity token and container permission role. After the detection is passed, the external access address of the data request is obtained, and the compliance of the external access address is checked. If the external access traffic compliance check is passed, the data request is transmitted to the local proxy server; if the external access traffic compliance check is not passed, an error instruction code is returned to the local proxy server.
4. The method for securely deploying AI agents in a Kubernetes environment according to claim 1, characterized in that, The steps are as follows: The main container of the intelligent agent performs data processing operations based on the external application data and the writable layer of the overlay file system container, obtains the data processing results, and saves them to an independent storage space; including: According to the task requirements, the main container of the intelligent agent generates an internal data request and obtains the internal data based on the read-only layer of the image of the overlay file system container.
5. The method for securely deploying AI agents in a Kubernetes environment according to claim 1, characterized in that, The AI agents that can be deployed in the main container include OpenClaw, AutoGPT, and ChatDev.
6. The method for securely deploying AI agents in a Kubernetes environment according to claim 1, characterized in that, The steps are as follows: Deploy the agent main container, the sidecar proxy container, and the overlay file system container on the smallest deployment unit of Kubernetes; the overlay file system container includes a container writable layer and an image read-only layer. include: In Kubernetes, the control plane receives task requests from the client through the ingress gateway. The control plane performs identity verification and task authorization on the user terminal and the task requirements. After the detection is successful, it assigns the corresponding work node to the task requirements. The working node sets up a minimum deployment unit according to the task requirements, and deploys the intelligent agent main container, the sidecar proxy container, and the overlay file system container on the minimum deployment unit.
7. The method for securely deploying AI agents in a Kubernetes environment according to claim 6, characterized in that, The steps include: the working node sets up a minimum deployment unit according to the task requirements, and deploys the intelligent agent main container, the sidecar proxy container, and the overlay file system container on the minimum deployment unit; including: A monitoring node is set up within the working node to monitor the resource usage of the minimum deployment unit and its contents in real time, and transmit the node resource usage information to the control plane. The control plane stores the node resource usage information transmitted by the monitoring nodes in the time-series database; Based on the load prediction algorithm, the future resource usage of the working node is predicted according to the current resource usage of the node. Based on the current resource usage of the nodes and the future resource usage of the working nodes, the resources of the working nodes are adjusted and scheduled for the smallest deployment unit.
8. The method for securely deploying AI agents in a Kubernetes environment according to claim 7, characterized in that, The step involves predicting the future resource usage of the working node based on the current resource usage of the node using a load prediction algorithm; including: Obtain the node resource usage status ; ; in, This refers to the node resource usage. For working nodes Processor utilization at any given moment For working nodes Memory usage at any given time For working nodes Disk utilization at any given time Within the working node Container utilization at any given time; The node's resource usage is calculated using an anomaly detection algorithm. Abnormal score ;include: Obtain the node resource usage at different times and construct sample nodes; The node resource usage Input, calculate the resource usage of the node. The height of each node in the sample nodes is used to calculate the anomaly score based on the average path length of the sample nodes. ; in, Node resource usage The average height of each node in the sample nodes, This represents the average path length of the sample nodes. The node resource occupancy information is input into a first temporal convolutional network to obtain a predicted normal load situation; the abnormal score and the node resource occupancy information are input into a second temporal convolutional network to obtain a predicted extreme load situation; the abnormal score and the node resource occupancy information are input into a classification network to obtain a predicted classification probability. Based on the predicted classification probability, predicted normal load conditions, and predicted extreme load conditions, calculate the future resource usage. ; in, For future resource usage, To predict the probability of the first category being the normal load in the future, To predict normal load conditions, To predict the probability of a second category with an extreme load in the future, To predict extreme load conditions.
9. The method for securely deploying AI agents in a Kubernetes environment according to claim 7, characterized in that, The step involves controlling the work node to adjust resource scheduling for the minimum deployment unit based on the current resource usage of the node and the future resource usage of the work node; including: Based on the preset deployment of the smallest deployment unit in the working node, and according to the node resource usage and the future resource usage, the total processor utilization of the working node to execute the task is calculated. ; in, For the first The predicted processor utilization of each minimum deployment unit, with a total of preset values. A minimum deployment unit is used to process the task request. Total processor utilization for all minimum deployment units; Set the scaling threshold for the minimum deployment unit; ; ; in, This is the reduction threshold. For expansion threshold, Minimum processor utilization for the smallest deployment unit. Highest processor utilization for the smallest deployment unit; Execute corresponding scaling strategies for the minimum deployment unit based on the scaling threshold and the total processor utilization. ; in, The number of optimized units is adjusted to minimize deployment size. The rounding up symbol, The floor symbol is used for rounding down. To determine the sign of the maximum value, The minimum standard number of units required for deployment; Based on the available resources and optimization adjustment quantity of all minimum deployment units, set the optimal adjustment quantity of the minimum deployment unit; ; in, The optimal number of adjustments for the smallest deployment unit. To take the sign of the minimum value, This represents the available resources of the smallest deployment unit under the default deployment configuration. The maximum amount of available resources for each smallest deployment unit.
10. A system for securely deploying AI agents in a Kubernetes environment, characterized in that, include: The container deployment module is used to deploy the main agent container, the sidecar proxy container, and the overlay file system container on the smallest deployment unit of Kubernetes; the overlay file system container includes a container writable layer and an image read-only layer. The data request module is used to receive data requests sent by the main intelligent agent container through the sidecar proxy container, perform source verification, inject credentials into the data request, and obtain external application data by connecting to the external application interface; the main intelligent agent container reads the external application data from the sidecar proxy container through a reserved loopback address; The data processing module is used by the main container of the intelligent agent to perform data processing operations based on the external application data and the container writable layer of the overlay file system container, obtain the data processing results, and save them to an independent storage space.