CN111782766A - Method and system for retrieving all resources in Kubernetes cluster through keywords - Google Patents

Method and system for retrieving all resources in Kubernetes cluster through keywords Download PDF

Info

Publication number
CN111782766A
CN111782766A CN202010613441.4A CN202010613441A CN111782766A CN 111782766 A CN111782766 A CN 111782766A CN 202010613441 A CN202010613441 A CN 202010613441A CN 111782766 A CN111782766 A CN 111782766A
Authority
CN
China
Prior art keywords
resources
cluster
server
retrieving
keywords
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.)
Granted
Application number
CN202010613441.4A
Other languages
Chinese (zh)
Other versions
CN111782766B (en
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.)
Fujian Jiankangzhilu Information Technology Co ltd
Original Assignee
Fujian Jiankangzhilu 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 Fujian Jiankangzhilu Information Technology Co ltd filed Critical Fujian Jiankangzhilu Information Technology Co ltd
Priority to CN202010613441.4A priority Critical patent/CN111782766B/en
Publication of CN111782766A publication Critical patent/CN111782766A/en
Application granted granted Critical
Publication of CN111782766B publication Critical patent/CN111782766B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/3332Query translation
    • G06F16/3334Selection or weighting of terms from queries, including natural language queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/335Filtering based on additional data, e.g. user or group profiles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/338Presentation of query results

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to the technical field of computers, in particular to a method and a system for retrieving all resources in a Kubernetes cluster through keywords. The method for retrieving all resources in the Kubernets cluster through keywords comprises the following steps: calling a Kubernetes API to obtain all resources in Namespace, and caching all the resources into a server memory; acquiring an input cluster name, acquiring an input keyword, and retrieving and filtering all resources in all Namespace in a server memory according to the cluster name and the keyword; and displaying the retrieval filtering result. The Namespace information does not need to be provided in the whole process, so that the Namespace does not need to be switched for retrieval for many times even under the condition that the Namespace is more, and the operation and management are convenient.

Description

Method and system for retrieving all resources in Kubernetes cluster through keywords
Technical Field
The invention relates to the technical field of computers, in particular to a method and a system for retrieving all resources in a Kubernetes cluster through keywords.
Background
The retrieval resource is a necessary function of a Kubernetes (K8S for short) management tool, the current retrieval mode is generally to select a cluster and Namespace, a keyword of a Delpoymet name is input in an input box, and the rear end calls Kubernetes API to perform fuzzy matching to retrieve the matched resource.
It can be found that the existing retrieval mode requires the user to provide three pieces of information, which are: the cluster name, Namespace name and the Delpoyment keyword, while the name of Delpoyment is only allowed to be composed of lowercase English, numbers and "-" in Kubernets, so that the distinguishing and memorizing are difficult, and the user experience is poor because the Chinese retrieval cannot be supported. In addition, in the case of many namespaces, it may be necessary to switch namespaces many times to search, which is extremely troublesome in daily management.
Disclosure of Invention
Therefore, a method for searching all resources in a Kubernetes cluster through keywords needs to be provided to solve the problems that the existing K8S searching mode is complex in searching operation and incomplete in searched resources, and the specific technical scheme is as follows:
a method of retrieving all resources in a kubernets cluster by keyword, comprising the steps of:
calling a Kubernetes API to obtain all resources in Namespace, and caching all the resources into a server memory;
acquiring an input cluster name, acquiring an input keyword, and retrieving and filtering all resources in all Namespace in a server memory according to the cluster name and the keyword;
and displaying the retrieval filtering result.
Further, the method also comprises the following steps:
monitoring whether the resources in the Kubernetes cluster are changed, if so, deleting old data in the memory of the server, and updating the latest data to the memory of the server.
Further, the monitoring whether the resource in the kubernets cluster is changed further includes the steps of:
calling an HTTP API of the APIServer to monitor whether the resources in the Kubernetes cluster are changed or not in a long polling mode.
Further, the input keywords comprise one or more of the following: chinese, english, numbers, characters.
In order to solve the technical problem, a system for retrieving all resources in a kubernets cluster through keywords is also provided, and the specific technical scheme is as follows:
a system for retrieving all resources in a kubernets cluster by keyword, comprising: a client and a server;
the client is used for: calling a Kubernetes API to obtain all resources in Namespace, and caching all the resources into the server-side memory;
the client is further configured to: acquiring an input cluster name and sending the cluster name to the server, acquiring an input keyword and sending the keyword to the server;
the server is further configured to: retrieving and filtering all resources in all Namespace in the memory of the server side according to the cluster name and the keywords, and returning a retrieval and filtering result to the client side;
the client is further configured to: and displaying the retrieval filtering result.
Further, the client is further configured to: monitoring whether the resources in the Kubernetes cluster are changed, if so, deleting old data in the memory of the server, and updating the latest data to the memory of the server.
Further, the client is further configured to: calling an HTTP API of the APIServer to monitor whether the resources in the Kubernetes cluster are changed or not in a long polling mode.
Further, the input keywords comprise one or more of the following: chinese, english, numbers, characters.
The invention has the beneficial effects that: and acquiring all resources in all Namespaces by calling a Kubernets API, caching all resources into a server memory, only acquiring cluster names and keywords when searching the resources, then searching and filtering all resources in all Namespaces in the server memory according to the cluster names and the keywords, and displaying the searching and filtering results. The Namespace information does not need to be provided in the whole process, so that the Namespace does not need to be switched for retrieval for many times even under the condition that the Namespace is more, and the operation and management are convenient.
In addition, K8S is a Google open source technology, and is not friendly to Chinese support, so that the search condition is limited to be composed of characters common in english environments such as english, numbers, underlines and the like. But any character can be included in the annotation, but since K8S does not provide support for the retrieval mode of the annotation, Chinese retrieval cannot be realized. In the technical scheme, all resources in Namespace are cached in the memory of the server, so that the Chinese retrievable effect can be achieved by retrieving Chinese in the annotation in the memory, and the user experience is greatly improved.
Drawings
FIG. 1 is a flowchart of a method for retrieving all resources in a Kubernets cluster via keywords according to an embodiment;
fig. 2 is a schematic block diagram of a system for retrieving all resources in a kubernets cluster through keywords according to an embodiment.
Description of reference numerals:
201. the client-side is connected with the server,
202. and a server side.
Detailed Description
To explain technical contents, structural features, and objects and effects of the technical solutions in detail, the following detailed description is given with reference to the accompanying drawings in conjunction with the embodiments.
Referring to fig. 1, in this embodiment, the method for retrieving all resources in a kubernets cluster through a keyword may be applied to a system for retrieving all resources in a kubernets cluster through a keyword, where the system for retrieving all resources in a kubernets cluster through a keyword includes: the client is in communication connection with the server. The specific implementation can be as follows:
step S101: and calling a Kubernetes API to acquire all resources in Namespace, and caching all the resources into a server memory.
Step S102: and acquiring the input cluster name. In this embodiment, the client is provided with a UI search interface, and the user can enter a K8S cluster by inputting the cluster name in the search box on the UI interface. In other embodiments, all cluster names may be displayed on the UI interface of the client, and the user enters the K8S cluster he wants to enter by clicking the corresponding cluster name.
After entering the desired cluster, step S103 is executed: and acquiring the input keywords. I.e. the user enters a keyword (the keyword may be any content containing chinese) on the UI.
After the server side obtains the cluster name and the keywords input by the client user, step S104 is executed: and searching and filtering all resources in all Namespace in the memory of the server side according to the cluster name and the keywords.
Step S105: and displaying the retrieval filtering result. The method specifically comprises the following steps: and the server returns the retrieval filtering result to the client, and the retrieval filtering result is displayed on the UI of the client.
And acquiring all resources in all Namespaces by calling a Kubernets API, caching all resources into a server memory, only acquiring cluster names and keywords when searching the resources, then searching and filtering all resources in all Namespaces in the server memory according to the cluster names and the keywords, and displaying the searching and filtering results. The Namespace information does not need to be provided in the whole process, so that the Namespace does not need to be switched for retrieval for many times even under the condition that the Namespace is more, and the operation and management are convenient.
Further, in order to ensure real-time performance of the returned results. Further comprising the steps of: monitoring whether the resources in the Kubernetes cluster are changed, if so, deleting old data in the memory of the server, and updating the latest data to the memory of the server.
Wherein said monitoring whether resources in a kubernets cluster have changed further comprises the steps of:
calling an HTTP API of the APIServer to monitor whether the resources in the Kubernetes cluster are changed or not in a long polling mode.
Monitoring whether the resources in the Kubernetes cluster are changed in real time or at regular time, if so, deleting old data in a server memory, and updating latest data to the server memory. This ensures that the retrieved data returned to the client is up to date.
In this embodiment, the input keywords include one or more of the following: chinese, english, numbers, characters. Since K8S is a Google open source technology and is not friendly to chinese support, the search condition is limited to be composed of only characters that are common in english environments such as english, numbers, underlines, and the like. But any character can be included in the annotation, but since K8S does not provide support for the retrieval mode of the annotation, Chinese retrieval cannot be realized. In the technical scheme, all resources in Namespace are cached in the memory of the server, so that the Chinese retrievable effect can be achieved by retrieving Chinese in the annotation in the memory, and the user experience is greatly improved.
Referring to fig. 2, in this embodiment, a specific implementation of a system 200 for searching all resources in a kubernets cluster through keywords is as follows:
a system 200 for retrieving all resources in a kubernets cluster via keywords, comprising: a client 201 and a server 202;
the client 201 is configured to: calling a Kubernetes API to obtain all resources in Namespace, and caching all the resources into the memory of the server 202;
the client 201 is further configured to: acquiring an input cluster name and sending the cluster name to the server 202, acquiring an input keyword and sending the keyword to the server 202;
the server 202 is further configured to: retrieving and filtering all resources in all namespaces in the memory of the server 202 according to the cluster name and the keywords, and returning a retrieval and filtering result to the client 201;
the client 201 is further configured to: and displaying the retrieval filtering result.
In this embodiment, the client 201 is provided with a UI search interface, and the user can enter a K8S cluster by inputting the cluster name in the search box on the UI interface. In other embodiments, all cluster names may be displayed on the UI interface of the client 201, and the user enters the K8S cluster he wants to enter by clicking the corresponding cluster name.
Calling a Kubernetes API through the client 201 to obtain all resources in all Namespaces, caching all resources in the memory of the server 202, when resource retrieval is carried out, only a cluster name and keywords are needed to be obtained, then the server 202 carries out retrieval filtering on all resources in all Namespaces in the memory of the server 202 according to the cluster name and the keywords, and returns a retrieval filtering result to the client 201, and the client 201 displays the retrieval filtering result. The Namespace information does not need to be provided in the whole process, so that the Namespace does not need to be switched for retrieval for many times even under the condition that the Namespace is more, and the operation and management are convenient.
Further, in order to ensure real-time performance of the returned results. The client 201 is further configured to: monitoring whether the resources in the Kubernetes cluster are changed, if so, deleting old data in the memory of the server 202, and updating the latest data to the memory of the server 202.
Further, the client 201 is further configured to: calling an HTTP API of the APIServer to monitor whether the resources in the Kubernetes cluster are changed or not in a long polling mode.
Monitoring whether the resources in the Kubernets cluster are changed or not in real time or at regular time through the client 201, if so, deleting old data in the memory of the server 202, and updating the latest data to the memory of the server 202. This ensures that the retrieved data returned to the client is up to date.
Further, the input keywords comprise one or more of the following: chinese, english, numbers, characters. Since K8S is a Google open source technology and is not friendly to chinese support, the search condition is limited to be composed of only characters that are common in english environments such as english, numbers, underlines, and the like. But any character can be included in the annotation, but since K8S does not provide support for the retrieval mode of the annotation, Chinese retrieval cannot be realized. In the technical scheme, all resources in Namespace are cached in the memory of the server 202, so that the Chinese retrievable effect can be achieved by retrieving Chinese in annotations in the memory, and the user experience is greatly improved.
It should be noted that, although the above embodiments have been described herein, the invention is not limited thereto. Therefore, based on the innovative concepts of the present invention, the technical solutions of the present invention can be directly or indirectly applied to other related technical fields by making changes and modifications to the embodiments described herein, or by using equivalent structures or equivalent processes performed in the content of the present specification and the attached drawings, which are included in the scope of the present invention.

Claims (8)

1. A method for retrieving all resources in a kubernets cluster by keywords, comprising the steps of:
calling a Kubernetes API to obtain all resources in Namespace, and caching all the resources into a server memory;
acquiring an input cluster name, acquiring an input keyword, and retrieving and filtering all resources in all Namespace in a server memory according to the cluster name and the keyword;
and displaying the retrieval filtering result.
2. The method of claim 1, further comprising the steps of:
monitoring whether the resources in the Kubernetes cluster are changed, if so, deleting old data in the memory of the server, and updating the latest data to the memory of the server.
3. A method of retrieving all resources in a Kubernets cluster by means of keywords according to claim 2,
the monitoring whether the resource in the Kubernets cluster is changed or not further comprises the following steps:
calling an HTTP API of the APIServer to monitor whether the resources in the Kubernetes cluster are changed or not in a long polling mode.
4. A method of retrieving all resources in a Kubernets cluster by means of keywords according to claim 1,
the input keywords comprise one or more of the following: chinese, english, numbers, characters.
5. A system for retrieving all resources in a kubernets cluster via keywords, comprising: a client and a server;
the client is used for: calling a Kubernetes API to obtain all resources in Namespace, and caching all the resources into the server-side memory;
the client is further configured to: acquiring an input cluster name and sending the cluster name to the server, acquiring an input keyword and sending the keyword to the server;
the server is further configured to: retrieving and filtering all resources in all Namespace in the memory of the server side according to the cluster name and the keywords, and returning a retrieval and filtering result to the client side;
the client is further configured to: and displaying the retrieval filtering result.
6. A system for retrieving all resources in a Kubernets cluster by keywords according to claim 5,
the client is further configured to: monitoring whether the resources in the Kubernetes cluster are changed, if so, deleting old data in the memory of the server, and updating the latest data to the memory of the server.
7. A system for retrieving all resources in a Kubernets cluster by keyword as claimed in claim 6,
the client is further configured to: calling an HTTP API of the APIServer to monitor whether the resources in the Kubernetes cluster are changed or not in a long polling mode.
8. A system for retrieving all resources in a Kubernets cluster by keywords according to claim 5,
the input keywords comprise one or more of the following: chinese, english, numbers, characters.
CN202010613441.4A 2020-06-30 2020-06-30 Method and system for retrieving all resources in Kubernetes cluster through keywords Active CN111782766B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010613441.4A CN111782766B (en) 2020-06-30 2020-06-30 Method and system for retrieving all resources in Kubernetes cluster through keywords

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010613441.4A CN111782766B (en) 2020-06-30 2020-06-30 Method and system for retrieving all resources in Kubernetes cluster through keywords

Publications (2)

Publication Number Publication Date
CN111782766A true CN111782766A (en) 2020-10-16
CN111782766B CN111782766B (en) 2023-02-24

Family

ID=72761173

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010613441.4A Active CN111782766B (en) 2020-06-30 2020-06-30 Method and system for retrieving all resources in Kubernetes cluster through keywords

Country Status (1)

Country Link
CN (1) CN111782766B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115114361A (en) * 2022-06-25 2022-09-27 上海道客网络科技有限公司 Resource retrieval method and system based on container cloud platform unified interface

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107633094A (en) * 2017-10-11 2018-01-26 江苏神州信源***工程有限公司 The method and apparatus of data retrieval in a kind of cluster environment
CN108108223A (en) * 2017-11-30 2018-06-01 国网浙江省电力公司信息通信分公司 Container Management platform based on Kubernetes
CN109067828A (en) * 2018-06-22 2018-12-21 杭州才云科技有限公司 Based on the more cluster construction methods of Kubernetes and OpenStack container cloud platform, medium, equipment
WO2019184164A1 (en) * 2018-03-30 2019-10-03 平安科技(深圳)有限公司 Method for automatically deploying kubernetes worker node, device, terminal apparatus, and readable storage medium
CN110609704A (en) * 2019-09-19 2019-12-24 聚好看科技股份有限公司 Method, device and system for adjusting gray scale of service program version
CN111010304A (en) * 2019-12-23 2020-04-14 浪潮云信息技术有限公司 Method for integrating Dubbo service and Kubernetes system
CN111258851A (en) * 2020-01-14 2020-06-09 广州虎牙科技有限公司 Cluster alarm method, device, setting and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107633094A (en) * 2017-10-11 2018-01-26 江苏神州信源***工程有限公司 The method and apparatus of data retrieval in a kind of cluster environment
CN108108223A (en) * 2017-11-30 2018-06-01 国网浙江省电力公司信息通信分公司 Container Management platform based on Kubernetes
WO2019184164A1 (en) * 2018-03-30 2019-10-03 平安科技(深圳)有限公司 Method for automatically deploying kubernetes worker node, device, terminal apparatus, and readable storage medium
CN109067828A (en) * 2018-06-22 2018-12-21 杭州才云科技有限公司 Based on the more cluster construction methods of Kubernetes and OpenStack container cloud platform, medium, equipment
CN110609704A (en) * 2019-09-19 2019-12-24 聚好看科技股份有限公司 Method, device and system for adjusting gray scale of service program version
CN111010304A (en) * 2019-12-23 2020-04-14 浪潮云信息技术有限公司 Method for integrating Dubbo service and Kubernetes system
CN111258851A (en) * 2020-01-14 2020-06-09 广州虎牙科技有限公司 Cluster alarm method, device, setting and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115114361A (en) * 2022-06-25 2022-09-27 上海道客网络科技有限公司 Resource retrieval method and system based on container cloud platform unified interface
CN115114361B (en) * 2022-06-25 2023-07-07 上海道客网络科技有限公司 Resource retrieval method and system based on unified interface of container cloud platform

Also Published As

Publication number Publication date
CN111782766B (en) 2023-02-24

Similar Documents

Publication Publication Date Title
US10956834B2 (en) Tool for machine-learning data analysis
RU2522103C2 (en) Update notification method and browser
US20180032518A1 (en) Systems and methods for graphical exploration of forensic data
TWI519979B (en) Information recommendation method and device thereof and information resource recommendation system
US8244719B2 (en) Computer method and apparatus providing social preview in tag selection
KR102550540B1 (en) Landing page processing method, device, equipment and medium
US11556592B1 (en) Storage estimate generation
WO2008154042A1 (en) System and method for the generation, storage and navigation of contextually anchored links
CN103678704A (en) Picture recognition method, system, equipment and device based on picture information
US7970758B2 (en) Automatic completion with LDAP
CN111782766B (en) Method and system for retrieving all resources in Kubernetes cluster through keywords
CN113656737A (en) Webpage content display method and device, electronic equipment and storage medium
JP5185891B2 (en) Content providing apparatus, content providing method, and content providing program
JP2001331486A (en) Website integrated retrieval method on communication and recording medium storing software programmed so as to perform the method
CN110704481B (en) Method and device for displaying data
CN105701231A (en) Network resource search system and method
CN116578712A (en) Retrieval and map analysis method based on knowledge base in knowledge map field
CN112486796B (en) Method and device for collecting information of vehicle-mounted intelligent terminal
JPH10307746A (en) Hypertext processor and medium stored with hypertext processor control program
CN114218258A (en) User label management method, system, equipment and storage medium
CN115033812A (en) Information processing method, device, terminal and storage medium
CN114997116A (en) Document editing method, device, equipment and storage medium
CN113268184A (en) Browser tab switching method and device, electronic equipment and readable medium
US9659022B2 (en) File object browsing and searching across different domains
CN111767450A (en) Browser data acquisition system and method

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
GR01 Patent grant
GR01 Patent grant