CN115469891A - Container mirror image management control method and system in Kubernetes cluster environment - Google Patents

Container mirror image management control method and system in Kubernetes cluster environment Download PDF

Info

Publication number
CN115469891A
CN115469891A CN202211108163.2A CN202211108163A CN115469891A CN 115469891 A CN115469891 A CN 115469891A CN 202211108163 A CN202211108163 A CN 202211108163A CN 115469891 A CN115469891 A CN 115469891A
Authority
CN
China
Prior art keywords
mirror
image
container
mirror image
images
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211108163.2A
Other languages
Chinese (zh)
Inventor
车帅
张�成
李振
赵井达
侯静静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Qianyun Qichuang Information Technology Co ltd
Original Assignee
Shandong Qianyun Qichuang Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Qianyun Qichuang Information Technology Co ltd filed Critical Shandong Qianyun Qichuang Information Technology Co ltd
Priority to CN202211108163.2A priority Critical patent/CN115469891A/en
Publication of CN115469891A publication Critical patent/CN115469891A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1479Generic software techniques for error detection or fault masking
    • G06F11/1482Generic software techniques for error detection or fault masking by means of middleware or OS functionality

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of cloud computing, and provides a container mirror image management control method and a system in a Kubernetes cluster environment, wherein the method comprises the following steps: accessing resources deployed in a container cloud environment through a Kubernetes interface service, and acquiring mirror image information used by the Kubernetes in a manner of circularly traversing all the deployed resources to form an operating mirror image list; and executing image removal or image deletion, performing container image file abstract comparison, and deleting images outside the running image list. The method and the device guarantee reliable operation of cloud application and service in the Kubernetes cluster environment, and effectively prevent errors that the image file cannot be downloaded.

Description

Container mirror image management control method and system in Kubernetes cluster environment
Technical Field
The invention belongs to the technical field of cloud computing, and particularly relates to a container mirror image management control method and system in a Kubernetes cluster environment.
Background
The statements in this section merely provide background information related to the present disclosure and may not constitute prior art.
With the application of the DevOps tool and the cloud computing container technology, more and more applications adopt a container IMAGE format as a unified format for development, deployment test, production and operation, as the DevOps tool is developing continuously integrated and continuously delivered applications, a large number of application IMAGE files are stored in an IMAGE warehouse storing the applications in an organization, as the application is continuously integrated/continuously delivered in a software development and construction process, the applications are frequently constructed and are constructed for many times every day, after each construction, a newly constructed container IMAGE covers a container IMAGE of the same version label in the last construction, and the last constructed IMAGE automatically becomes a < none > label IMAGE file which can be confirmed and used only by IMAGE summary information (such as registration: 2.7.1@ sha 256.
In a container warehouse, because a large number of < none > label image files are generated by continuously integrating and automatically constructing application container images every day, great challenges are brought to storage space and retrieval efficiency, and at present, the following two methods are mainly used for the container management and control methods:
in the general case, most organizations currently use tags to manage container IMAGEs, keep container IMAGE files of the specified tags through tools, and do not process or directly delete < none > tag IMAGE files based on manual management of IMAGE summary information (e.g., registry:2.7.1@ sha256. According to the technical scheme, the mirror image file of the < none > tag is not processed or is directly and completely deleted, a user needs to be quite clear of the mirror image abstract in the mirror image warehouse, only the mirror image version tag is clear, the fact that the mirror image in use of the cluster is deleted by mistake cannot be guaranteed, normal telescopic operation or upgrading and returning last operation of the number of instances of the cluster environment is affected, and normal operation of the cluster is affected.
The other is a time-based management control mode, and the image files in the designated time period are automatically or manually reserved and deleted through commands and tools. The technical scheme can not ensure that the mirror image used by the cluster is deleted by mistake, and the normal telescopic operation or the upgrading and returning operation of the number of instances of the cluster environment are influenced, so that the normal operation of the cluster is influenced.
Both the two modes have certain limitations, image management of deploying various versions in various environments is very troublesome, manual confirmation is needed, and image files of containers running by cloud applications/services in a Kubernets cluster environment or application image files used by cloud and application services when rollback operation is executed are easily deleted by mistake under any condition.
Disclosure of Invention
In order to solve the technical problems existing in the background technology, the invention provides a container mirror image management control method and system in a Kubernets cluster environment, wherein resources deployed in a container cloud environment are accessed through a Kubernets interface service, mirror image information used in the Kubernets cluster environment is acquired, a running mirror image list is formed, when clearing and deleting operations are executed, the mirror images are guaranteed not to be cleared from a container mirror image warehouse, the reliable running of cloud application and service in the Kubernets cluster environment is guaranteed, and errors that mirror image files cannot be downloaded are effectively prevented.
In order to achieve the purpose, the invention adopts the following technical scheme:
the first aspect of the present invention provides a container mirror image management control method in a kubernets cluster environment, which includes:
accessing resources deployed in a container cloud environment through a Kubernetes interface service, and acquiring mirror image information used by the Kubernetes in a manner of circularly traversing all the deployed resources to form an operating mirror image list;
and executing image removal or image deletion, performing container image file abstract comparison, and deleting images outside the running image list.
Further, the specific steps of executing the mirror image removal are as follows:
traversing all mirror images in the container mirror image list, judging whether each mirror image is a < none > tag, and if not, ignoring the mirror images; if yes, comparing the abstracts of the mirror image files, judging whether the mirror images are in the operating environment list, if yes, ignoring the mirror images, and recording logs; if not, the image is deleted.
Further, the container image manifest is formed by obtaining all container images from an image repository.
Further, the specific steps of executing the mirror image deletion are as follows:
traversing the mirror images to be deleted, comparing the abstracts of the mirror image files, judging whether each mirror image is in the operating environment list, and if so, ignoring the mirror images; if not, the image file is deleted.
A second aspect of the present invention provides a container mirror management control system in a kubernets cluster environment, which includes:
a running mirror list acquisition module configured to: accessing resources deployed in a container cloud environment through a Kubernetes interface service, and acquiring mirror image information used by the Kubernetes to circularly traverse all the deployed resources to form a running mirror image list;
a mirror control module configured to: and executing image removal or image deletion, performing container image file abstract comparison, and deleting images outside the running image list.
Further, the mirror control module comprises a mirror removal module;
the image removal module configured to: traversing all the mirror images in the container mirror image list, judging whether each mirror image is a < none > tag, and if not, ignoring the mirror images; if yes, comparing the abstracts of the mirror image files, judging whether the mirror images are in the operating environment list, if yes, ignoring the mirror images, and recording a log; if not, the image is deleted.
Further, the container mirror manifest is formed by obtaining all container mirrors from a mirror repository.
Further, the mirror image control module comprises a mirror image deleting module;
the image deletion module configured to: traversing the mirror image to be deleted, comparing the abstracts of the mirror image files, judging whether each mirror image is in the operating environment list, and if so, ignoring the mirror image; if not, the mirror is deleted.
A third aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps in the method for controlling container mirror image management in a kubernets cluster environment as described above.
A fourth aspect of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps in the method for controlling container mirror image management in a kubernets cluster environment as described above.
Compared with the prior art, the invention has the beneficial effects that:
the invention provides a management control method of a container mirror image in a Kubernets cluster environment, which accesses resources deployed in a container cloud environment through a Kubernets interface service, acquires mirror image information used in the Kubernets cluster environment to form an operation mirror image list, ensures that the mirror images cannot be cleared from a container mirror image warehouse when clearing and deleting operations are executed, effectively utilizes and saves storage space, effectively prevents the error phenomenon that the mirror image file cannot be downloaded when the cloud service in the cluster environment is normally operated, ensures the reliable operation of cloud application and service in the Kubernets cluster environment, and effectively prevents the error that the mirror image file cannot be downloaded.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the invention and together with the description serve to explain the invention and not to limit the invention.
Fig. 1 is a flowchart of a method for managing and controlling container mirror images in a kubernets cluster environment according to an embodiment of the present invention;
FIG. 2 is a diagram of the overall architecture of the DevOps tool platform according to the first embodiment of the present invention;
fig. 3 is a flowchart of executing deleting a mirror according to a first embodiment of the present invention.
Detailed Description
The invention is further described with reference to the following figures and examples.
It is to be understood that the following detailed description is exemplary and is intended to provide further explanation of the invention as claimed. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
Interpretation of terms:
kubernetes cluster: a set of nodes running a containerized application. The containerized application packages the application with its dependent items and some necessary services.
< none > tag mirroring: many mirror images named none appear after long use by Docker.
Example one
The embodiment provides a management control method for a container mirror image in a Kubernets cluster environment, which comprises the steps of accessing resources deployed in a container cloud environment through a Kubernets interface service, obtaining mirror image information used in the Kubernets cluster environment, forming an operation mirror image list, comparing container mirror image file abstracts (hash values calculated by using an SHA256 algorithm) when clearing and deleting operations are executed, ensuring that the mirror images cannot be cleared from a container mirror image warehouse, effectively utilizing and saving storage space, effectively preventing error phenomena that the mirror image files cannot be downloaded during normal operation of cloud services in the cluster environment, improving reliability of operation of the Kubernets cluster container cloud application environment, providing technical guarantee for stable operation of cloud applications of the Kubernets cluster container, and ensuring reliable operation of the cloud applications and services in the Kubernets cluster environment.
The method for managing and controlling container mirror images in a Kubernetes cluster environment provided by this embodiment is used as a container mirror image control part in a DevOps tool platform, the overall architecture of the DevOps tool platform is shown in fig. 2, the DevOps tool platform is connected with a plurality of container development environment clusters, and each container development environment cluster comprises a plurality of containers; the DevOps tool platform comprises a continuous integration/continuous delivery software (CI/CD) component, a cluster management component, a container mirror warehouse and a container mirror management component, wherein the container mirror warehouse component is responsible for storing a plurality of container mirrors; the container mirror image control component is responsible for cleaning out obsolete and useless container mirror images in the container mirror image warehouse; as shown in fig. 1, the method comprises the following steps:
step 1, a container mirror image control component of the DevOps tool platform receives container mirror image clearing instruction information or container mirror image deleting instruction information of a user, and acquires cluster configuration information (including an IP address, a port and user information of a kubenetes cluster) and a timing strategy (including whether timing generation is started or not and a time interval (unit second)) for running mirror image list generation.
And 2, acquiring all container mirror image information from the mirror image warehouse API to form a container mirror image list.
And 3, traversing the running cloud application and service in the cluster environment configured in the cluster configuration information by the container mirror image control component according to the timing strategy setting generated by the running mirror image list, and generating the running mirror image list.
Accessing resources deployed in a container cloud environment through a Kubernets API (application programming interface) service, acquiring mirror image information used by the Kubernets to circularly traverse all deployed resources, and forming an operation mirror image list, so as to ensure that a cloud application and a mirror image used by a cloud service which are running in a cluster environment are not cleared from a mirror image warehouse, namely, a mirror image file used in the Kubernets cluster environment is eliminated.
And 4, when the mirror image removal is executed, traversing all mirror images and comparing with the running mirror image list in the step 3 based on the mirror image list of all containers of the mirror image warehouse obtained in the step 2, and deleting the mirror images except the running mirror image list.
Specifically, in response to the container mirror image clearing instruction information, traversing all mirror images in a warehouse (container mirror image list), judging whether each mirror image is a < none > tag, if not, ignoring the mirror image, and recording a log; if yes, comparing the abstracts (SHA 256) of the mirror image files, judging whether the mirror images are in the operating environment list, if yes, ignoring the mirror images, and recording logs; if not, executing mirror image deletion and log recording; and displaying the execution result until the traversal is finished.
And 5, when the mirror image is deleted, traversing the mirror image to be deleted, comparing the mirror image with the running mirror image list, and deleting the mirror images outside the running mirror image list.
Specifically, as shown in fig. 3, in response to the instruction information for deleting the container mirror image, the mirror image to be deleted is traversed, the abstracts (hash values calculated by using the SHA256 algorithm) of the mirror images are compared, whether each mirror image is in the operating environment list is judged, and if yes, the mirror image file is ignored, and the log is recorded; if the image file is not in the list, executing a docker rmi instruction to delete the image file and record the log until the traversal is finished, and returning and displaying the instruction execution result.
And 6, maintaining an operation mirror image list. And adding, deleting and editing the running mirror image list through an administrative tool interface, maintaining the running mirror image list and ensuring that the files in the list are not deleted when the step 5 is executed.
The container mirror image management control method in the kubernets cluster environment provided by the embodiment can fully meet various requirements of mirror image management of various cluster environments, improve mirror image retrieval efficiency, save storage space, guarantee reliable operation of cloud application and service in the kubernets cluster environment, and effectively prevent errors that mirror image files cannot be downloaded.
Example two
The embodiment provides a container mirror image management control system in a kubernets cluster environment, which specifically comprises the following modules:
a running mirror list acquisition module configured to: accessing resources deployed in a container cloud environment through a Kubernetes interface service, and acquiring mirror image information used by the Kubernetes to circularly traverse all the deployed resources to form a running mirror image list;
a mirror control module configured to: and clearing the mirror image or deleting the mirror image, comparing the abstracts of the container mirror image files, and deleting the mirror image outside the running mirror image list.
The mirror image control module comprises a mirror image clearing module and a mirror image deleting module.
A mirror cleanup module configured to: traversing all the mirror images in the container mirror image list, judging whether each mirror image is a < none > tag, and if not, ignoring the mirror images; if yes, comparing the abstracts of the mirror image files, judging whether the mirror images are in the operating environment list, if yes, ignoring the mirror images, and recording a log; if not, the mirror image is deleted. The container mirror manifest is formed by taking all container mirrors from the mirror store.
A mirror deletion module configured to: traversing the mirror images to be deleted, comparing the abstracts of the mirror image files, judging whether each mirror image is in the operating environment list, and if so, ignoring the mirror images; if not, the mirror is deleted.
The management control system for the container mirror images in the Kubernets cluster environment provided by the embodiment can fully meet the requirements of various aspects of mirror image management of various cluster environments, improve the mirror image retrieval efficiency, save the storage space, ensure the reliable operation of cloud application and service in the Kubernets cluster environment, and effectively prevent the error that the mirror image files cannot be downloaded.
It should be noted that, each module in the present embodiment corresponds to each step in the first embodiment one to one, and the specific implementation process is the same, which is not described herein again.
EXAMPLE III
The present embodiment provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps in the method for controlling container image management in a kubernets cluster environment as described in the first embodiment.
Example four
This embodiment provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps in the method for controlling container mirror image management in a kubernets cluster environment as described in the first embodiment.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A management control method for container mirror images in a Kubernets cluster environment is characterized by comprising the following steps:
accessing resources deployed in a container cloud environment through a Kubernetes interface service, and acquiring mirror image information used by the Kubernetes to circularly traverse all the deployed resources to form a running mirror image list;
and executing image removal or image deletion, performing container image file abstract comparison, and deleting images outside the running image list.
2. The container mirror image management control method in a Kubernetes cluster environment as claimed in claim 1, wherein the specific step of executing the mirror image removal is:
traversing all the mirror images in the container mirror image list, judging whether each mirror image is a < none > tag, and if not, ignoring the mirror images; if yes, comparing the abstracts of the mirror image files, judging whether the mirror images are in the operating environment list, if yes, ignoring the mirror images, and recording a log; if not, the image is deleted.
3. The method for managing and controlling container images in a kubernets cluster environment as claimed in claim 2, wherein the container image list is formed by acquiring all container images from an image warehouse.
4. The container mirror image management control method in the kubernets cluster environment according to claim 1, wherein the specific step of executing the mirror image deletion is:
traversing the mirror image to be deleted, comparing the abstracts of the mirror image files, judging whether each mirror image is in the operating environment list, and if so, ignoring the mirror image; if not, the image file is deleted.
5. A system for managing and controlling container mirror images in a Kubernets cluster environment, comprising:
a running mirror list acquisition module configured to: accessing resources deployed in a container cloud environment through a Kubernetes interface service, and acquiring mirror image information used by the Kubernetes to circularly traverse all the deployed resources to form a running mirror image list;
a mirror control module configured to: and executing image removal or image deletion, performing container image file abstract comparison, and deleting images outside the running image list.
6. The system of claim 5, wherein said mirror control module comprises a mirror clean-up module;
the image removal module configured to: traversing all the mirror images in the container mirror image list, judging whether each mirror image is a < none > tag, and if not, ignoring the mirror images; if yes, comparing the abstracts of the mirror image files, judging whether the mirror images are in the operating environment list, if yes, ignoring the mirror images, and recording a log; if not, the image is deleted.
7. The system of claim 6, wherein the container image manifest is formed by retrieving all container images from a container registry.
8. The system of claim 5, wherein said mirror control module comprises a mirror deletion module;
the image deletion module configured to: traversing the mirror images to be deleted, comparing the abstracts of the mirror image files, judging whether each mirror image is in the operating environment list, and if so, ignoring the mirror images; if not, the mirror is deleted.
9. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the steps of a method for controlling management of mirror images of containers in a kubernets cluster environment according to any one of claims 1-4.
10. A computer apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for controlling management of container images in a kubernets environment as claimed in any one of claims 1-4 when executing the program.
CN202211108163.2A 2022-09-13 2022-09-13 Container mirror image management control method and system in Kubernetes cluster environment Pending CN115469891A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211108163.2A CN115469891A (en) 2022-09-13 2022-09-13 Container mirror image management control method and system in Kubernetes cluster environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211108163.2A CN115469891A (en) 2022-09-13 2022-09-13 Container mirror image management control method and system in Kubernetes cluster environment

Publications (1)

Publication Number Publication Date
CN115469891A true CN115469891A (en) 2022-12-13

Family

ID=84333944

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211108163.2A Pending CN115469891A (en) 2022-09-13 2022-09-13 Container mirror image management control method and system in Kubernetes cluster environment

Country Status (1)

Country Link
CN (1) CN115469891A (en)

Similar Documents

Publication Publication Date Title
US11847484B2 (en) Virtual machine image management using delta trees
US8286154B2 (en) Apparatus and method for live loading of version upgrades in a process control environment
US9940108B2 (en) Automated merging in a software development environment
US6714949B1 (en) Dynamic file system configurations
US7194475B2 (en) Method, system, and program for performing an impact analysis of program statements in at least one source code file
US20070185879A1 (en) Systems and methods for archiving and retrieving digital assets
US8112745B2 (en) Apparatus and method for capabilities verification and restriction of managed applications in an execution environment
CN106227621B (en) The data back up method and system of logic-based volume management simplification volume
US20070256075A1 (en) Method, system, and memory for scheduling and cancelling tasks
US10346150B2 (en) Computerized system and method for patching an application by separating executables and working data using different images
CN112596762A (en) Rolling upgrading method and device
CN103902562A (en) Method and device for upgrading terminal databases
CN115686932B (en) Backup set file recovery method and device and computer equipment
CN111190687A (en) Container mirror image construction method, device, equipment and storage medium
US7818557B2 (en) Method for re-imaging a computer system
CN101853165A (en) Management method and system for library in configuration software
US11010408B2 (en) Hydration of a hierarchy of dehydrated files
CN115469891A (en) Container mirror image management control method and system in Kubernetes cluster environment
CN1866211B (en) Method for forced unloading of file system
CN115617459A (en) Method, device and equipment for resource scheduling
JP2013025655A (en) Log file management module and log file management method
CN112269677A (en) Rollback operation device, method, equipment and medium under heterogeneous cloud platform
JP2003280963A (en) Document management system, restoration method, program for performing restoration, and recording medium with program recorded thereon
CN113127376A (en) Control method, device and equipment of solid state drive
CN116760913B (en) Method and system for issuing k8s cluster protocol conversion platform configuration

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination