Machine learning model deployment method and device based on k8s, equipment and medium

By using kubebuilder to build CRD on the k8s platform and combining model service runtime mirroring, the problem of adapting to different model formats and frameworks is solved, automated deployment is achieved, management costs are reduced, and system efficiency is improved.

CN119847550AActive Publication Date: 2025-04-18SHANDONG INSPUR SCI RES INST CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510019531.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-04-18
Estimated Expiration
2045-01-07

AI Technical Summary

Technical Problem

The existing technology is difficult to adapt to different model formats and frameworks, and automatically selects the runtime environment and loads the model, resulting in complex deployment process, error-prone, and high management costs.

Method used

Using a k8s-based machine learning model deployment method, we create a runtime image of model service for different training frameworks, use kubebuilder to build a k8s CRD, realize the binding of the model format and runtime image, and automatically complete the model deployment.

Benefits of technology

It realizes the adaptation of different model formats and frameworks, automates the selection of runtime environments and model loading, simplifies the deployment process, reduces development and operation and maintenance costs, and improves the reliability and response speed of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847550A_ABST
    Figure CN119847550A_ABST
Patent Text Reader

Abstract

The invention discloses a k8s-based machine learning model deployment method, apparatus and device, and a medium, belongs to the technical field of cloud computing and machine learning, and aims to solve the technical problem of how to adapt to different model formats and frameworks, automatically select runtime environments and load models, and improve the efficiency of cloud computing and machine learning. According to the technical scheme, the method comprises the steps that S1, model service runtime mirror images for different training frames are made; s2, when the model service runs, loading a model file from a / mnt / model directory in a mirror image fixing manner; s3, constructing a mirror image when the model service runs, pushing the mirror image to a dokerhub or private harbor mirror image storage platform, and generating a corresponding mirror image address for use; s4, installing and configuring a golang environment and a make command tool so as to compile and construct the source code; s5, according to the requirements of the system, the kubuBuilder is downloaded and decompressed; s6, constructing a k8s CRD (Clustered Register Description) by using a kubuBuilder, wherein the name of the k8s CRD is serverruntime; s7, packaging the server runtime, and deploying the server runtime to a cluster; and S8, binding corresponding relations between different training frames and mirror images during model service operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cloud computing and machine learning, and specifically to a k8s-based machine learning model deployment method, device, equipment and medium. Background Art

[0002] With the rapid development of artificial intelligence and machine learning, more and more application scenarios rely on the reasoning and prediction functions of machine learning models. Major enterprises and research institutions use different training frameworks (such as Paddle, PyTorch, TensorFlow, etc.) to train and optimize models. These trained models need to be deployed in production environments to provide online reasoning services to meet the growing user needs. The model deployment process usually involves multiple complex operations, including selecting an appropriate runtime environment, configuring model storage, setting up reasoning services, and integrating with other applications or services. Traditional machine learning model deployment developers need to manually write a large number of YAML or JSON files to configure the model's runtime image, storage location, network service, and other information. This process is extremely complex, especially when thousands of model instances need to be managed in a production environment. Manually maintaining these configuration files is cumbersome and error-prone. The lifecycle management of machine learning models also faces many challenges. In actual scenarios, as business needs change and model versions are updated, developers need to frequently update models and redeploy services. This repetitive operation places a great burden on operation and maintenance personnel, especially when models of different frameworks and formats need to be managed uniformly. The traditional manual deployment method is prone to problems such as version inconsistency and model configuration errors, which seriously affect the stability and efficiency of the system. As the application scale of machine learning models continues to expand, developers are increasingly in need of deploying and managing multi-framework and multi-format models. A flexible, scalable and automated model deployment solution can not only reduce development and operation costs, but also significantly improve the reliability and response speed of the system. Therefore, how to adapt to different model formats and frameworks, automatically select the runtime environment and load the model is a technical problem that needs to be solved urgently. Summary of the invention

[0003] The technical task of the present invention is to provide a k8s-based machine learning model deployment method, device, equipment and medium to solve the problem of how to adapt to different model formats and frameworks, automatically select the runtime environment and load the model.

[0004] The technical task of the present invention is achieved in the following way: a machine learning model deployment method based on k8s, the method is as follows:

[0005] S1. Create model service runtime images for different training frameworks, including Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM.

[0006] S2, the model service runtime image is fixed to load the model file from the / mnt / models directory;

[0007] S3, build the model service runtime image, push the image to dockerhub or private harbor image storage platform, and generate the corresponding image address for use;

[0008] S4. Install and configure the golang environment and make command tool to compile and build the source code. In the Linux system, use the package manager to install golang and make, apt install golang, apt install make.

[0009] S5. Download and decompress kubebuilder according to system requirements.

[0010] S6. Use kubebuilder to build a k8s CRD (Custom Resource Definition) named serverruntime. Serverruntime is used to bind the model format and the model service runtime image.

[0011] S7. Package the serverruntime and deploy it to the cluster;

[0012] S8. Bind the corresponding relationship between different training frameworks and model service runtime images;

[0013] S9. Use kubebuilder to build k8s CRD (Custom Resource Definition) named modelserver. Modelserver is used to provide necessary information for model deployment.

[0014] S10. Package the modelserver and deploy it to the cluster;

[0015] S11. Create modelserver resources. You only need to specify the model format and the model storage address modelAddr to complete the model deployment.

[0016] Preferably, the steps of making model service runtime images for different training frameworks in step S1 are as follows:

[0017] S101. Select a suitable basic image as the basic image of the model service runtime image: Select the service image officially released by each training framework as the basic image of the model service runtime image. The officially released service image is pre-installed with various dependencies to reduce the complexity of image production;

[0018] S102. Write Python code app.py, in which the model is loaded from a fixed directory ( / mnt / models) and http service is provided;

[0019] S103, copy the code app.py to the / app directory inside the image;

[0020] S104, setting the startup command of the image to python / app / app.py;

[0021] S105. Use the docker build command to build the image.

[0022] Preferably, the kubebuilder in step S5 is a framework for building a Kubernetes API, which helps developers create custom controllers and custom resource definitions (CRD). By using Kubebuilder, developers can more easily extend the Kubernetes API to meet the needs of specific applications; according to system requirements, it is necessary to select an appropriate version according to the operating system (win, linux) and CPU architecture (X86, arm).

[0023] Preferably, the serverruntime in step S6 includes a format field and an image field;

[0024] The format field is used to identify the model format. The allowed values ​​are Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM.

[0025] The image field is used to identify the model service runtime image corresponding to the model format represented by the format field. The allowed value is the image address generated in step S3.

[0026] Preferably, before binding the correspondence between different training frameworks and model service runtime images in step S8, serverruntime CRDs with format values ​​of Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM are created respectively.

[0027] Preferably, the modelserver in step S9 includes a format field, a replicas field, a modelAddr field, and a standard podSpec field;

[0028] The format field is used to identify the model format. The allowed values ​​are Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM, which correspond to the format value of serverruntime. The corresponding model service runtime image address in serverruntime is found according to the format field value. This image is used as the POD image.

[0029] The replicas field is used to identify the number of PODs created by the Deployment, that is, the number of instances of model deployment. The default value is 1.

[0030] The modelAddr field is used to identify the model storage address and supports network paths;

[0031] The standard podSpec fields are used to describe the basic information of the POD. The podSpec does not contain the image field because the image field is determined by the format field.

[0032] Preferably, when creating the modelserver resource in step S11, the process is as follows:

[0033] Create a k8s Deployment resource based on the standard podPsec field. If the standard podSPec field is empty, build the podSpec yourself. The subordinate image field should be the matching model service runtime image address.

[0034] The number of replicas of a Deployment is the value of the replicas field;

[0035] Create an init container to download the image of the model storage address identified in the modelAddr field, and use the hostpath data volume to mount the downloaded model to the / mnt / models directory of the container;

[0036] Create k8s Sercice resources to complete the network proxy of Service to POD.

[0037] A k8s-based machine learning model deployment device, the device comprising:

[0038] A production module for producing model service runtime images for different training frameworks, including Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM.

[0039] Loading module, used for model service runtime image to load model files from / mnt / models directory;

[0040] The image building module is used to build the model service runtime image, push the image to DockerHub or the private Harbor image storage platform, and generate the corresponding image address for use;

[0041] The configuration module is used to install and configure the golang environment and make command tool to compile and build the source code. In the Linux system, use the package manager to install golang and make, apt install golang, apt install make;

[0042] Decompression module, used to download and decompress kubebuilder according to system requirements;

[0043] The serverruntime construction module is used to build k8s CRD (Custom Resource Definition) using kubebuilder. The name is serverruntime. Among them, serverruntime is used to bind the model format and the model service runtime image.

[0044] The serverruntime deployment module is used to package and deploy serverruntime to the cluster;

[0045] Binding module, used to bind the corresponding relationship between different training frameworks and model service runtime images;

[0046] The modelserver construction module is used to build k8s CRD (Custom Resource Definition) using kubebuilder. The name of the module is modelserver. Modelserver is used to provide the necessary information for model deployment.

[0047] Modelserver deployment module, used to package and deploy modelserver to the cluster;

[0048] The resource creation module is used to create modelserver resources. You only need to specify the model format and the model storage address modelAddr to complete the model deployment.

[0049] An electronic device comprising: a memory and at least one processor;

[0050] Wherein, the memory stores a computer program;

[0051] The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the k8s-based machine learning model deployment method as described above.

[0052] A computer-readable storage medium having a computer program stored therein, wherein the computer program can be executed by a processor to implement the k8s-based machine learning model deployment method as described above.

[0053] The k8s-based machine learning model deployment method, device, equipment and medium of the present invention have the following advantages:

[0054] (1) The present invention realizes the automatic creation and management of K8s resources through the combination of CRD and controller. Users do not need to manually write complex YAML files, which simplifies the deployment process. It can adapt to different model formats and frameworks, automatically select the runtime environment and load the model, which not only reduces the development and operation and maintenance costs, but also significantly improves the reliability and response speed of the system.

[0055] (ii) The present invention creates a k8s custom resource definition (CRD). Users only need to create the CRD to automatically complete the model deployment work, thereby greatly simplifying the model deployment process;

[0056] (III) The present invention automatically selects the runtime image and loads the model through CRD, which simplifies the deployment process and realizes the automated deployment process;

[0057] (iv) The present invention supports a variety of machine learning frameworks and model formats, can adapt to the model deployment requirements of different scenarios, and achieves the purpose of flexible expansion;

[0058] (V) The present invention uses a controller to automatically reconcile the K8s resource status to ensure that the resources in the K8s cluster are always consistent with the CRD definition, reducing the need for manual intervention and improving operation and maintenance efficiency, that is, ensuring that the model service is consistent with the expected state, reducing the operation and maintenance burden, and achieving efficient management;

[0059] (vi) The present invention only requires specifying the model format and address to complete the model, which reduces the difficulty of model deployment and ensures ease of use;

[0060] (VII) The present invention significantly reduces deployment errors caused by manual operations and improves system stability through automated processes and configuration verification mechanisms. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The present invention is further described below in conjunction with the accompanying drawings.

[0062] Attached Figure 1 A flowchart of the k8s-based machine learning model deployment method. DETAILED DESCRIPTION

[0063] The k8s-based machine learning model deployment method, device, equipment and medium of the present invention are described in detail below with reference to the drawings and specific embodiments of the specification.

[0064] Embodiment 1:

[0065] As attached Figure 1 As shown, this embodiment provides a method for deploying a machine learning model based on k8s, and the method is specifically as follows:

[0066] S1. Create model service runtime images for different training frameworks, including Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM.

[0067] S2, the model service runtime image is fixed to load the model file from the / mnt / models directory;

[0068] S3, build the model service runtime image, push the image to dockerhub or private harbor image storage platform, and generate the corresponding image address for use;

[0069] S4. Install and configure the golang environment and make command tool to compile and build the source code. In the Linux system, use the package manager to install golang and make, apt install golang, apt install make.

[0070] S5. Download and decompress kubebuilder according to system requirements.

[0071] S6. Use kubebuilder to build a k8s CRD (Custom Resource Definition) named serverruntime. Serverruntime is used to bind the model format and the model service runtime image.

[0072] S7. Package the serverruntime and deploy it to the cluster;

[0073] S8. Bind the corresponding relationship between different training frameworks and model service runtime images;

[0074] S9. Use kubebuilder to build k8s CRD (Custom Resource Definition) named modelserver. Modelserver is used to provide necessary information for model deployment.

[0075] S10. Package the modelserver and deploy it to the cluster;

[0076] S11. Create modelserver resources. You only need to specify the model format and the model storage address modelAddr to complete the model deployment.

[0077] The specific steps of making model service runtime images for different training frameworks in step S1 of this embodiment are as follows:

[0078] S101. Select a suitable basic image as the basic image of the model service runtime image: Select the service image officially released by each training framework as the basic image of the model service runtime image. The officially released service image is pre-installed with various dependencies to reduce the complexity of image production;

[0079] S102. Write Python code app.py, in which the model is loaded from a fixed directory ( / mnt / models) and http service is provided;

[0080] S103, copy the code app.py to the / app directory inside the image;

[0081] S104, setting the startup command of the image to python / app / app.py;

[0082] S105. Use the docker build command to build the image.

[0083] The kubebuilder in step S5 of this embodiment is a framework for building a Kubernetes API, which helps developers create custom controllers (controller) and custom resource definitions (Custom Resource Definitions, CRD). By using Kubebuilder, developers can more easily extend the Kubernetes API to meet the needs of specific applications; according to system requirements, it is necessary to select an appropriate version according to the operating system (win, linux) and CPU architecture (X86, arm).

[0084] The serverruntime in step S6 of this embodiment includes a format field and an image field;

[0085] The format field is used to identify the model format. The allowed values ​​are Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM.

[0086] The image field is used to identify the model service runtime image corresponding to the model format represented by the format field. The allowed value is the image address generated in step S3.

[0087] Before binding the correspondence between different training frameworks and model service runtime images in step S8 of this embodiment, serverruntime CRDs with format values ​​of Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost and LightGBM are created respectively.

[0088] The modelserver in step S9 of this embodiment includes a format field, a replicas field, a modelAddr field, and a standard podSpec field;

[0089] The format field is used to identify the model format. The allowed values ​​are Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM, which correspond to the format value of serverruntime. The corresponding model service runtime image address in serverruntime is found according to the format field value. This image is used as the POD image.

[0090] The replicas field is used to identify the number of PODs created by the Deployment, that is, the number of instances of model deployment. The default value is 1.

[0091] The modelAddr field is used to identify the model storage address and supports network paths;

[0092] The standard podSpec fields are used to describe the basic information of the POD. The podSpec does not contain the image field because the image field is determined by the format field.

[0093] In step S11 of this embodiment, the process of creating a modelserver resource is as follows:

[0094] ① Create a k8s Deployment resource based on the standard podPsec field. If the standard podSPec field is empty, build the podSpec yourself. The subordinate image field should be the matching model service runtime image address;

[0095] ②The number of replicas of the Deployment is the value of the replicas field;

[0096] ③ Create an init container to download the image of the model storage address identified in the modelAddr field, and use the hostpath data volume to mount the downloaded model to the / mnt / models directory of the container;

[0097] ④Create k8s Sercice resources to complete the network proxy of Service to POD.

[0098] Embodiment 2:

[0099] This embodiment provides a k8s-based machine learning model deployment device, which includes:

[0100] A production module for producing model service runtime images for different training frameworks, including Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM.

[0101] Loading module, used for model service runtime image to load model files from / mnt / models directory;

[0102] The image building module is used to build the model service runtime image, push the image to DockerHub or the private Harbor image storage platform, and generate the corresponding image address for use;

[0103] The configuration module is used to install and configure the golang environment and make command tool to compile and build the source code. In the Linux system, use the package manager to install golang and make, apt install golang, apt install make;

[0104] Decompression module, used to download and decompress kubebuilder according to system requirements;

[0105] The serverruntime construction module is used to build k8s CRD (Custom Resource Definition) using kubebuilder. The name is serverruntime. Among them, serverruntime is used to bind the model format and the model service runtime image.

[0106] The serverruntime deployment module is used to package and deploy serverruntime to the cluster;

[0107] Binding module, used to bind the corresponding relationship between different training frameworks and model service runtime images;

[0108] The modelserver construction module is used to build k8s CRD (Custom Resource Definition) using kubebuilder. The name of the module is modelserver. Modelserver is used to provide the necessary information for model deployment.

[0109] Modelserver deployment module, used to package and deploy modelserver to the cluster;

[0110] The resource creation module is used to create modelserver resources. You only need to specify the model format and the model storage address modelAddr to complete the model deployment.

[0111] Embodiment 3:

[0112] This embodiment also provides an electronic device, including: a memory and a processor;

[0113] Wherein, the memory stores computer-executable instructions;

[0114] The processor executes the computer execution instructions stored in the memory, so that the processor executes the k8s-based machine learning model deployment method in any embodiment of the present invention.

[0115] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.

[0116] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state storage devices.

[0117] Embodiment 4:

[0118] This embodiment also provides a computer-readable storage medium, which stores multiple instructions, which are loaded by a processor to enable the processor to execute the k8s-based machine learning model deployment method in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code that implements the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.

[0119] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0120] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0121] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0122] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0123] 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 replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for deploying a machine learning model based on k8s, characterized in that: The method is as follows: S1. Create model service runtime images for different training frameworks, including Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM. S2, the model service runtime image is fixed to load the model file from the / mnt / models directory; S3, build the model service runtime image, push the image to dockerhub or private harbor image storage platform, and generate the corresponding image address for use; S4. Install and configure the golang environment and make command tool to compile and build the source code. In the Linux system, use the package manager to install golang and make, apt install golang, apt install make. S5. Download and decompress kubebuilder according to system requirements. S6. Use kubebuilder to build a k8s CRD named serverruntime. Serverruntime is used to bind the model format and the model service runtime image. S7. Package the serverruntime and deploy it to the cluster; S8. Bind the corresponding relationship between different training frameworks and model service runtime images; S9. Use kubebuilder to build k8s CRD named modelserver. Modelserver is used to provide necessary information for model deployment. S10. Package the modelserver and deploy it to the cluster; S11. Create modelserver resources. You only need to specify the model format and the model storage address modelAddr to complete the model deployment.

2. The k8s-based machine learning model deployment method according to claim 1, characterized in that: The specific steps of making model service runtime images for different training frameworks in step S1 are as follows: S101. Select a suitable basic image as the basic image of the model service runtime image: select the service image officially released by each training framework as the basic image of the model service runtime image; S102. Write Python code app.py, in which the model is loaded from a fixed directory ( / mnt / models) and http service is provided; S103, copy the code app.py to the / app directory inside the image; S104, setting the startup command of the image to python / app / app.py; S105. Use the docker build command to build the image.

3. The k8s-based machine learning model deployment method according to claim 1, characterized in that: The kubebuilder in step S5 is a framework for building Kubernetes APIs, which helps developers create custom controllers and custom resource definitions. By using Kubebuilder, developers can more easily extend the Kubernetes API to meet the needs of specific applications. According to system requirements, it is necessary to select the appropriate version according to the operating system (win, linux) and CPU architecture (X86, arm).

4. The k8s-based machine learning model deployment method according to claim 1, characterized in that: The serverruntime in step S6 includes a format field and an image field; The format field is used to identify the model format. The allowed values ​​are Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM. The image field is used to identify the model service runtime image corresponding to the model format represented by the format field. The allowed value is the image address generated in step S3.

5. The k8s-based machine learning model deployment method according to claim 1, characterized in that: Before binding different training frameworks to the model service runtime images in step S8, create serverruntime CRDs with format values ​​of Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM respectively.

6. The k8s-based machine learning model deployment method according to claim 1, characterized in that: The modelserver in step S9 includes a format field, a replicas field, a modelAddr field, and a standard podSpec field; The format field is used to identify the model format. The allowed values ​​are Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM, which correspond to the format value of serverruntime. The corresponding model service runtime image address in serverruntime is found according to the format field value. This image is used as the POD image. The replicas field is used to identify the number of PODs created by the Deployment, that is, the number of instances of model deployment. The default value is 1. The modelAddr field is used to identify the model storage address and supports network paths; The standard podSpec fields are used to describe the basic information of the POD. The podSpec does not contain the image field because the image field is determined by the format field.

7. The k8s-based machine learning model deployment method according to any one of claims 1 to 6, characterized in that: When creating the modelserver resource in step S11, the process is as follows: Create a k8s Deployment resource based on the standard podPsec field. If the standard podSPec field is empty, build the podSpec yourself. The subordinate image field should be the matching model service runtime image address. The number of replicas of a Deployment is the value of the replicas field; Create an init container to download the image of the model storage address identified in the modelAddr field, and use the hostpath data volume to mount the downloaded model to the / mnt / models directory of the container; Create k8s Sercice resources to complete the network proxy of Service to POD.

8. A machine learning model deployment device based on k8s, characterized in that: The device includes: A production module for producing model service runtime images for different training frameworks, including Paddle, Pytorch, Tensorflow, Scikit-learn, XGBoost, and LightGBM. Loading module, used for model service runtime image to load model files from / mnt / models directory; The image building module is used to build the model service runtime image, push the image to DockerHub or the private Harbor image storage platform, and generate the corresponding image address for use; The configuration module is used to install and configure the golang environment and make command tool to compile and build the source code. In the Linux system, use the package manager to install golang and make, apt install golang, apt install make; Decompression module, used to download and decompress kubebuilder according to system requirements; The serverruntime construction module is used to build k8s CRD using kubebuilder. The name is serverruntime. Among them, serverruntime is used to bind the model format and the model service runtime image. The serverruntime deployment module is used to package and deploy serverruntime to the cluster; Binding module, used to bind the corresponding relationship between different training frameworks and model service runtime images; The modelserver construction module is used to build k8s CRD using kubebuilder, and its name is modelserver. Modelserver is used to provide necessary information for model deployment. Modelserver deployment module, used to package and deploy modelserver to the cluster; The resource creation module is used to create modelserver resources. You only need to specify the model format and the model storage address modelAddr to complete the model deployment.

9. An electronic device, characterized in that: include: memory and at least one processor; Wherein, the memory stores a computer program; The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the k8s-based machine learning model deployment method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed by a processor to implement the k8s-based machine learning model deployment method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Distributed training system based on containerization and construction method thereof

    CN115344356A

  • Service return-to-zero scaling method and system based on cloud native

    CN118819742A

  • Simple deployment method of K8s resources

    CN118860424A

  • Method for providing application construction service, and application construction platform, application deployment method and system

    WO2022037612A1

  • Method and system for constructing machine learning model automated production line

    WO2023071075A1