Search

CN-121996277-A - Method and device for updating container process, storage medium and electronic equipment

CN121996277ACN 121996277 ACN121996277 ACN 121996277ACN-121996277-A

Abstract

The application discloses a method and a device for updating a container process, a storage medium and electronic equipment. The method comprises the steps of obtaining an updating request for updating a first container process under the condition that the first container process is running, responding to the updating request, associating target process resources obtained based on resource obtaining data to a target directory, wherein the target directory is associated with process resources of at least one container process managed by a target process management component, reading the target process resources from the target directory by the target process management component, starting a second container process based on the target process resources, and sending resource access information of service resources managed by the first container process to the running second container process so that the second container process can obtain the service resources through the resource access information. The application solves the technical problem of poor service upgrading continuity.

Inventors

  • WANG CHENG
  • PENG LEI
  • SUN YONGFU

Assignees

  • 腾讯云计算(北京)有限责任公司

Dates

Publication Date
20260508
Application Date
20241029

Claims (13)

  1. 1. A method for updating a container process, comprising: Under the condition that a first container process is running, acquiring an update request for updating the first container process, wherein the update request carries resource acquisition data for acquiring target process resources for updating the first container process, and the first container process is a process running in a container; Responding to the update request, and associating target process resources obtained based on the resource acquisition data to a target directory, wherein the target directory is associated with process resources of at least one container process managed by a target process management component; Reading the target process resource from the target directory by using the target process management component, and starting a second container process based on the target process resource, wherein the second container process is a container process after updating the first container process; and sending the resource access information of the business resources managed by the first container process to the running second container process so that the second container process can acquire the business resources through the resource access information.
  2. 2. The method of claim 1, wherein the sending resource access information for the business resources managed by the first container process to the second container process being run comprises: Creating a process communication auxiliary object for the second container process, wherein the process communication auxiliary object is used for providing communication service between container processes; Creating a process communication connection between the first container process and the second container process through the process communication auxiliary object; And sending the resource access information of the business resources managed by the first container process to the running second container process through the process communication connection.
  3. 3. The method of claim 2, wherein said sending said resource access information for a business resource managed by said first container process to said second container process being run over said process communication connection comprises: Transmitting a link creation triggering event included in the resource access information to the running second container process through the process communication connection, wherein the link creation triggering event is used for creating a data transmission link between a client and the container process when a link creation request is triggered; A second data transfer link is created between the client and the second container process if the second container process determines that the link creation request has been triggered based on the link creation trigger event.
  4. 4. The method of claim 3, wherein said sending said resource access information for a business resource managed by said first container process to said second container process being run over said process communication connection further comprises: And transmitting link information of a first data transmission link and a history session message included in the resource access information to the second container process which is running through the process communication connection, wherein the first data transmission link is a data transmission link which is created between the client and the first container process when the first container process determines that the link creation request is triggered based on the link creation trigger event, and the history session message is used for indicating the session message which is transmitted between the client and the first container process.
  5. 5. The method of claim 4, further comprising, after said sending said resource access information of a business resource managed by said first container process to said second container process being run over said process communication connection: creating a trigger event for the first container process to terminate the link and adjusting the first data transmission link to a terminated communication state.
  6. 6. The method of any of claims 1 to 5, wherein the associating the target process resource derived based on the resource acquisition data to a target directory comprises: Acquiring a storage path of the target process resource; under the condition that the target process resource is managed by the target process management component, acquiring an access address allocated for the target process resource from the target directory; the storage path is associated to the access address.
  7. 7. The method according to any one of claims 1 to 5, further comprising, after said sending resource access information of a service resource managed by said first container process to said second container process being executed, to cause said second container process to acquire said service resource through said resource access information: Under the condition that the target directory is determined to be associated with a first process resource of the first container process, releasing the association relationship between the first process resource and the target directory; And under the condition that the association relation between the first process resource and the target directory is successfully released, terminating the first container process by utilizing the target process management component.
  8. 8. The method of any of claims 1 to 5, further comprising, prior to the obtaining an update request for updating the first container process: determining a target container for running the first container process; The target process management component is configured as a master container in a container cluster in which the target container is located, wherein the master container is used for managing each container in the container cluster.
  9. 9. The method according to any one of claims 1 to 5, further comprising, after said obtaining an update request for updating said first container process: Under the condition that the resource acquisition data comprises the process compression resource of the target process resource, decompressing the process compression resource to obtain the target process resource, or And sending a request message for requesting the process compression resource to a cloud storage server under the condition that the resource acquisition data comprises a resource storage address of the process compression resource of the target process resource in the cloud storage server, wherein the cloud storage server acquires the process compression resource based on the resource storage address carried in the request message and sends the process compression resource to the target server under the condition that the request message is received, and the target server is a server for running the first container process, and carrying out decompression processing on the process compression resource under the condition that the process compression resource sent by the cloud storage server is received to obtain the target process resource.
  10. 10. An apparatus for updating a container process, comprising: the device comprises an acquisition unit, a first container process and a second container process, wherein the acquisition unit is used for acquiring an update request for updating a first container process under the condition that the first container process is running, and the update request carries resource acquisition data for acquiring target process resources for updating the first container process, and the first container process is a process running in a container; The association unit is used for responding to the update request and associating the target process resources obtained based on the resource acquisition data to a target directory, wherein the target directory is associated with the process resources of at least one container process managed by a target process management component; the starting unit is used for reading the target process resource from the target directory by utilizing the target process management component and starting a second container process based on the target process resource, wherein the second container process is a container process after updating the first container process; And the sending unit is used for sending the resource access information of the business resources managed by the first container process to the running second container process so that the second container process can acquire the business resources through the resource access information.
  11. 11. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored program, wherein the program, when executed by a processor, performs the method of any one of claims 1 to 9.
  12. 12. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the method of any one of claims 1 to 9.
  13. 13. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 9 by means of the computer program.

Description

Method and device for updating container process, storage medium and electronic equipment Technical Field The present application relates to the field of computers, and in particular, to a method and apparatus for updating a container process, a storage medium, and an electronic device. Background Kubernetes (K8 s for short) is an open-source container arrangement platform, provides powerful, extensible and flexible container arrangement functions, can automatically deploy, extend and manage containerized application programs, improves the efficiency of development and operation and maintenance teams, reduces complexity and ensures high availability and reliability of the application programs. To ensure continued availability and security of the application, technicians need to update the application, repair security vulnerabilities, optimize performance, or introduce new functionality as needed when using K8s, thus requiring updates to the container processes in K8 s. Currently, for updating a container process in K8s, a method is generally adopted in which the container process to be updated is ended first, and all service resources corresponding to the process are cleared. And then, after the process resources of the updated container process are acquired, starting the updated container process, and using the container process to receive the service required to be processed by the container application before updating. However, in the process of updating by adopting the updating method of the container process, the process of the containerized application program of the stock service is terminated, a new service request cannot be received during the process termination period, and the service corresponding to the service request is processed, so that the technical problem of poor service upgrading continuity is caused. In view of the above problems, no effective solution has been proposed at present. Disclosure of Invention The embodiment of the application provides a method and a device for updating a container process, a storage medium and electronic equipment, which are used for at least solving the technical problem of poor service upgrading continuity. According to one aspect of the embodiment of the application, an updating method of a container process is provided, and the updating method comprises the steps of acquiring an updating request for updating a first container process under the condition that the first container process is running, wherein the updating request carries resource acquisition data for acquiring target process resources for updating the first container process, the first container process is a process running in a container, responding to the updating request, associating the target process resources acquired based on the resource acquisition data to a target directory, wherein the target directory is associated with process resources of at least one container process managed by a target process management component, reading the target process resources from the target directory by the target process management component, and starting a second container process based on the target process resources, wherein the second container process is the container process after updating the first container process, and sending resource access information of service resources managed by the first container process to the second container process running so that the second container process acquires the service resources through the resource access information. According to another aspect of the embodiment of the application, there is provided an updating device of a container process, which comprises an acquiring unit, an associating unit and a starting unit, wherein the acquiring unit is used for acquiring an updating request for updating a first container process under the condition that the first container process is running, the updating request carries resource acquisition data for acquiring target process resources for updating the first container process, the first container process is a process running in a container, the associating unit is used for associating the target process resources acquired based on the resource acquisition data to a target directory in response to the updating request, the target directory is associated with at least one process resource of the container processes managed by a target process management component, the starting unit is used for reading the target process resources from the target directory by the target process management component and starting a second container process based on the target process resources, the second container process is the updated container process, and the transmitting unit is used for transmitting resource access information of service resources managed by the first container process to the running second container process so that the second container process acquires the service resources through the resource acce