Search

US-12625750-B2 - Automatic state migration of stateful container during secondary application container hot upgrade

US12625750B2US 12625750 B2US12625750 B2US 12625750B2US-12625750-B2

Abstract

Secondary application container hot upgrade is provided. It is determined whether an upgraded secondary application container is ready to run in a pod that includes a secondary application container, a router container, and a primary application container based on monitoring a status of the upgraded secondary application container. The router container is directed to send a subsequent external service request to the upgraded secondary application container to manage for the primary application container in response to determining that the upgraded secondary application container is ready to run. The secondary application container is deleted from the pod that includes the upgraded secondary application container in response to directing the router container to send the subsequent external service request to the upgraded secondary application container to manage for the primary application container. The router container is deleted from the pod in response to deleting the secondary application container from the pod.

Inventors

  • Yue Wang
  • Xinpeng LIU
  • Wei Wu
  • Liang Wang
  • Biao Chai

Assignees

  • INTERNATIONAL BUSINESS MACHINES CORPORATION

Dates

Publication Date
20260512
Application Date
20230817

Claims (20)

  1. 1 . A computer-implemented method for secondary application container hot upgrade, the computer-implemented method comprising: determining, by a computer, whether an upgraded secondary application container is ready to run in a pod that includes a secondary application container, a router container created in the pod specifically for a hot-upgrade operation, and a primary application container based on monitoring a status of the upgraded secondary application container; directing, by the computer, the router container to send a subsequent external service request to the upgraded secondary application container to manage for the primary application container in response to the computer determining that the upgraded secondary application container is ready to run in the pod based on monitoring the status of the upgraded secondary application container; deleting, by the computer, the secondary application container from the pod that includes the upgraded secondary application container in response to the computer directing the router container to send the subsequent external service request to the upgraded secondary application container to manage for the primary application container; and deleting, by the computer, the router container after completion of the hot-upgrade operation and after deleting the secondary application container from the pod.
  2. 2 . The computer-implemented method of claim 1 , wherein the upgraded secondary application container is a new version of the secondary application container.
  3. 3 . The computer-implemented method of claim 1 , further comprising: directing, by the computer, the router container to send the subsequent external service request to the secondary application container to manage for the primary application container in response to the computer determining that the upgraded secondary application container is not ready to run in the pod based on monitoring the status of the upgraded secondary application container.
  4. 4 . The computer-implemented method of claim 1 , further comprising: receiving, by the computer, other subsequent external service requests for a service provided by the primary application container after hot upgrade to the upgraded secondary application container is complete; and sending, by the computer, the other subsequent external service requests for the service provided by the primary application container to a port the upgraded secondary application container is now monitoring to manage the other subsequent external service requests for the primary application container.
  5. 5 . The computer-implemented method of claim 1 , further comprising: receiving, by the computer, from a user via a client device, an external service request for a service provided by the primary application container located in the pod of a host node corresponding to the computer prior to hot upgrade of the secondary application container located with the primary application container in the pod, wherein the secondary application container manages external service requests corresponding to the primary application container; and sending, by the computer, the external service request for the service provided by the primary application container to a port that the secondary application container monitors to manage the external service request for the primary application container.
  6. 6 . The computer-implemented method of claim 1 , further comprising: receiving, by the computer, an input to perform hot upgrade of the secondary application container located with the primary application container in the pod; and generating, by the computer, using a secondary application container controller, the router container and the upgraded secondary application container in the pod of a host node that already contains the secondary application container and the primary application container in response to performing the hot upgrade of the secondary application container.
  7. 7 . The computer-implemented method of claim 1 , further comprising: directing, by the computer, the router container to monitor a port for external service requests corresponding to the primary application container; and monitoring, by the computer, the status of the upgraded secondary application container via a probe.
  8. 8 . The computer-implemented method of claim 7 , further comprising: receiving, by the computer, the subsequent external service request for a service provided by the primary application container during hot upgrade of the secondary application container to the upgraded secondary application container; and sending, by the computer, the subsequent external service request for the service provided by the primary application container to the port the router container is monitoring.
  9. 9 . A computer system for secondary application container hot upgrade, the computer system comprising: a communication fabric; a storage device connected to the communication fabric, wherein the storage device stores program instructions; and a processor connected to the communication fabric, wherein the processor executes the program instructions to: determine whether an upgraded secondary application container is ready to run in a pod that includes a secondary application container, a router container created in the pod specifically for a hot-upgrade operation, and a primary application container based on monitoring a status of the upgraded secondary application container; direct the router container to send a subsequent external service request to the upgraded secondary application container to manage for the primary application container in response to determining that the upgraded secondary application container is ready to run in the pod based on monitoring the status of the upgraded secondary application container; delete the secondary application container from the pod that includes the upgraded secondary application container in response to directing the router container to send the subsequent external service request to the upgraded secondary application container to manage for the primary application container; and delete the router container after completion of the hot-upgrade operation and after deleting the secondary application container from the pod.
  10. 10 . The computer system of claim 9 , wherein the upgraded secondary application container is a new version of the secondary application container.
  11. 11 . The computer system of claim 9 , wherein the processor further executes the program instructions to: direct the router container to send the subsequent external service request to the secondary application container to manage for the primary application container in response to determining that the upgraded secondary application container is not ready to run in the pod based on monitoring the status of the upgraded secondary application container.
  12. 12 . The computer system of claim 9 , wherein the processor further executes the program instructions to: receive other subsequent external service requests for a service provided by the primary application container after hot upgrade to the upgraded secondary application container is complete; and send the other subsequent external service requests for the service provided by the primary application container to a port the upgraded secondary application container is now monitoring to manage the other subsequent external service requests for the primary application container.
  13. 13 . The computer system of claim 9 , wherein the processor further executes the program instructions to: receive, from a user via a client device, an external service request for a service provided by the primary application container located in the pod of a host node corresponding to the computer system prior to hot upgrade of the secondary application container located with the primary application container in the pod, wherein the secondary application container manages external service requests corresponding to the primary application container; and send the external service request for the service provided by the primary application container to a port that the secondary application container monitors to manage the external service request for the primary application container.
  14. 14 . The computer system of claim 9 , wherein the processor further executes the program instructions to: receive an input to perform hot upgrade of the secondary application container located with the primary application container in the pod; and generate, using a secondary application container controller, the router container and the upgraded secondary application container in the pod of a host node that already contains the secondary application container and the primary application container in response to performing the hot upgrade of the secondary application container.
  15. 15 . A computer program product for secondary application container hot upgrade, the computer program product comprising a computer-readable storage medium having program instructions embodied therewith, the program instructions executable by a computer to cause the computer to: determine whether an upgraded secondary application container is ready to run in a pod that includes a secondary application container, a router container created in the pod specifically for a hot-upgrade operation, and a primary application container based on monitoring a status of the upgraded secondary application container; direct the router container to send a subsequent external service request to the upgraded secondary application container to manage for the primary application container in response to determining that the upgraded secondary application container is ready to run in the pod based on monitoring the status of the upgraded secondary application container; delete the secondary application container from the pod that includes the upgraded secondary application container in response to directing the router container to send the subsequent external service request to the upgraded secondary application container to manage for the primary application container; and delete the router container after completion of the hot-upgrade operation and after deleting the secondary application container from the pod.
  16. 16 . The computer program product of claim 15 , wherein the upgraded secondary application container is a new version of the secondary application container.
  17. 17 . The computer program product of claim 15 , wherein the program instructions further cause the computer to: direct the router container to send the subsequent external service request to the secondary application container to manage for the primary application container in response to determining that the upgraded secondary application container is not ready to run in the pod based on monitoring the status of the upgraded secondary application container.
  18. 18 . The computer program product of claim 15 , wherein the program instructions further cause the computer to: receive other subsequent external service requests for a service provided by the primary application container after hot upgrade to the upgraded secondary application container is complete; and send the other subsequent external service requests for the service provided by the primary application container to a port the upgraded secondary application container is now monitoring to manage the other subsequent external service requests for the primary application container.
  19. 19 . The computer program product of claim 15 , wherein the program instructions further cause the computer to: receive, from a user via a client device, an external service request for a service provided by the primary application container located in the pod of a host node corresponding to the computer prior to hot upgrade of the secondary application container located with the primary application container in the pod, wherein the secondary application container manages external service requests corresponding to the primary application container; and send the external service request for the service provided by the primary application container to a port that the secondary application container monitors to manage the external service request for the primary application container.
  20. 20 . The computer program product of claim 15 , wherein the program instructions further cause the computer to: receive an input to perform hot upgrade of the secondary application container located with the primary application container in the pod; and generate, using a secondary application container controller, the router container and the upgraded secondary application container in the pod of a host node that already contains the secondary application container and the primary application container in response to performing the hot upgrade of the secondary application container.

Description

BACKGROUND The disclosure relates generally to container orchestration architectures and more specifically to automatic state migration of stateful container during secondary application container hot upgrade in a container orchestration architecture. A container orchestration architecture, such as, for example, Kubernetes® (a registered trademark of the Linux Foundation of San Francisco, California, USA), is used to deploy and manage containerized applications across host nodes on a cloud environment or within on-premises servers. A host node is a machine, either physical or virtual, where containers (i.e., application workload) are deployed. The smallest deployable unit that can be created and managed in a container orchestration architecture is a pod. A pod encapsulates the containerized application. Typically, a single container is configured in a pod, but there are times when configuring multiple containers in a single pod is needed. This usually occurs when there are two or more containers tightly coupled to each other. For example, a primary application container and a secondary application container (e.g., sidecar container) can exist in the same pod. The primary application container contains the application code or main business logic, while the secondary application container serves as a helper container that provides complementary functionality to support the services provided by the primary application container. The secondary application container runs in the same network as the primary application container, enabling the containers to communicate with each other. In addition, the two containers share resources, such as, for example, pod storage, network interfaces, and the like. For example, the secondary application container can share storage volumes with the primary application container, allowing the primary application container to access the data in the secondary application container. Further, the secondary application container can be developed in a different programming language than that of the primary application container, which provides increased flexibility for the services provided by the primary application container. In other words, the secondary application container can enhance and extend the functionalities of the primary application container without having to modify the application code in the primary application container when additional functionality that is handled more efficiently in another programming language is needed. SUMMARY According to one illustrative embodiment, a computer-implemented method for secondary application container hot upgrade is provided. A computer determines whether an upgraded secondary application container is ready to run in a pod that includes a secondary application container, a router container, and a primary application container based on monitoring a status of the upgraded secondary application container. The computer directs the router container to send a subsequent external service request to the upgraded secondary application container to manage for the primary application container in response to the computer determining that the upgraded secondary application container is ready to run in the pod based on monitoring the status of the upgraded secondary application container. The computer deletes the secondary application container from the pod that includes the upgraded secondary application container in response to the computer directing the router container to send the subsequent external service request to the upgraded secondary application container to manage for the primary application container. The computer deletes the router container from the pod in response to the computer deleting the secondary application container from the pod. According to other illustrative embodiments, a computer system and computer program product for secondary application container hot upgrade are provided. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a pictorial representation of a computing environment in which illustrative embodiments may be implemented; FIG. 2 is a diagram illustrating an example of a secondary application container hot upgrade system in accordance with an illustrative embodiment; FIGS. 3A-3B are a diagram illustrating an example of a secondary application container hot upgrade process in accordance with an illustrative embodiment; and FIGS. 4A-4B are a flowchart illustrating a process for secondary application container hot upgrade while continuing to provide uninterrupted service by a corresponding primary application container in accordance with an illustrative embodiment. DETAILED DESCRIPTION A computer-implemented method provides secondary application container hot upgrade. A computer determines whether an upgraded secondary application container is ready to run in a pod that includes a secondary application container, a router container, and a primary application container based on monitoring a status of the upgraded sec