第 18 章 Searching and filtering
The ability to instantly find resources is important to safeguard your cluster. Use Red Hat Advanced Cluster Security for Kubernetes search feature to find relevant resources faster. For example, you can use it to find deployments that are exposed to a newly published CVE or find all deployments that have external network exposure.
18.1. Search syntax 复制链接链接已复制到粘贴板!
A search query is made up of two parts:
- An attribute that identifies the resource type you want to search for.
- A search term that finds the matching resource.
For example, to find all violations in the visa-processor deployment, the search query is Deployment:visa-processor. In this search query, Deployment is the attribute and visa-processor is the search term.
You must select an attribute before you can use search terms. However, in some views, such as the Risk view and the Violations view, Red Hat Advanced Cluster Security for Kubernetes automatically applies the relevant attribute based on the search term you enter.
You can use multiple attributes in your query. When you use more than one attribute, the results only include the items that match all attributes.
Example
When you search for
Namespace:frontend CVE:CVE-2018-11776, it returns only those resources which violate CVE-2018-11776 in thefrontendnamespace.You can use more than one search term with each attribute. When you use more than one search term, the results include all items that match any of the search terms.
Example
If you use the search query
Namespace: frontend backend, it returns matching results from the namespacefrontendorbackend.You can combine multiple attribute and search term pairs.
Example
The search query
Cluster:production Namespace:frontend CVE:CVE-2018-11776returns all resources which violate CVE-2018-11776 in thefrontendnamespace in theproductioncluster.Search terms can be part of a word, in which case Red Hat Advanced Cluster Security for Kubernetes returns all matching results.
Example
If you search for
Deployment:def, the results include all deployments starting withdef.To explicitly search for a specific term, use the search terms inside quotes.
Example
When you search for
Deployment:"def", the results only include the deploymentdef.You can also use regular expressions by using
r/before your search term.Example
When you search for
Namespace:r/st.*x, the results include matches from namespacestackroxandstix.Use
!to indicate the search terms that you do not want in results.Example
If you search for
Namespace:!stackrox, the results include matches from all namespaces except thestackroxnamespace.Use the comparison operators
>,<,=,>=, or<=to match a specific value or range of values.Example
If you search for
CVSS:>=6, the results include all vulnerabilities with Common Vulnerability Scoring System (CVSS) score 6 or higher.