Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 2. Search in the console


For Red Hat Advanced Cluster Management for Kubernetes, search provides visibility into your Kubernetes resources across all of your clusters. Search also indexes the Kubernetes resources and the relationships to other resources.

2.1. Search components

The search architecture is composed of the following components:

Table 2.1. Search component table
Component nameMetricsMetric typeDescription

search-collector

  

Watches the Kubernetes resources, collects the resource metadata, computes relationships for resources across all of your managed clusters, and sends the collected data to the search-indexer. The search-collector on your managed cluster runs as a pod named, klusterlet-addon-search.

search-indexer

Receives resource metadata from the collectors and writes to PostgreSQL database. The search-indexer also watches resources in the hub cluster to keep track of active managed clusters.

search_indexer_request_duration

Histogram

Time (seconds) the search indexer takes to process a request (from managed cluster).

search_indexer_request_size

Histogram

Total changes (add, update, delete) in the search indexer request (from managed cluster).

search_indexer_request_count

Counter

Total requests received by the search indexer (from managed clusters).

search_indexer_requests_in_flight

Gauge

Total requests the search indexer is processing at a given time.

search-api

Provides access to all cluster data in the search-indexer through GraphQL and enforces role-based access control (RBAC).

search_api_requests

Histogram

Histogram of HTTP requests duration in seconds.

search_dbquery_duration_seconds

Histogram

Latency of database requests in seconds.

search_api_db_connection_failed_total

Counter

The total number of database connection attempts that failed.

search-postgres

  

Stores collected data from all managed clusters in an instance of the PostgreSQL database.

Search is configured by default on the hub cluster. When you provision or manually import a managed cluster, the klusterlet-addon-search is enabled. If you want to disable search on your managed cluster, see Modifying the klusterlet add-ons settings of your cluster for more information.

2.2. Search customization and configurations

You can modify the default values in the search-v2-operator custom resource. To view details of the custom resource, run the following command:

oc get search search-v2-operator -o yaml

The search operator watches the search-v2-operator custom resource, reconciles the changes and updates active pods. View the following descriptions of the configurations:

  • PostgreSQL database storage:

    When you install Red Hat Advanced Cluster Management, the PostgreSQL database is configured to save the PostgreSQL data in an empty directory (emptyDir) volume. If the empty directory size is limited, you can save the PostgreSQL data on a Persistent Volume Claim (PVC) to improve search performance. You can select a storageclass from your Red Hat Advanced Cluster Management hub cluster to back up your search data. For example, if you select the gp2 storageclass your configuration might resemble the following example:

    apiVersion: search.open-cluster-management.io/v1alpha1
    kind: Search
    metadata:
      name: search-v2-operator
      namespace: open-cluster-management
      labels:
        cluster.open-cluster-management.io/backup: ""
    spec:
      dbStorage:
        size: 10Gi
        storageClassName: gp2

    This configuration creates a PVC named gp2-search and is mounted to the search-postgres pod. By default, the storage size is 10Gi. You can modify the storage size. For example, 20Gi might be sufficient for about 200 managed clusters.

  • Optimize cost by tuning the pod memory or CPU requirements, replica count, and update log levels for any of the four search pods (indexer, database, queryapi, or collector pod). Update the deployment section of the search-v2-operator custom resource. There are four deployments managed by the search-v2-operator, which can be updated individually. Your search-v2-operator custom resource might resemble the following file:

    apiVersion: search.open-cluster-management.io/v1alpha1
    kind: Search
    metadata:
      name: search-v2-operator
      namespace: open-cluster-management
    spec:
      deployments:
        collector:
          resources: 1
            limits:
              cpu: 500m
              memory: 128Mi
            requests:
              cpu: 250m
              memory: 64Mi
        indexer:
          replicaCount: 3
        database: 2
            envVar:
              - name: POSTGRESQL_EFFECTIVE_CACHE_SIZE
                value: 1024MB
              - name: POSTGRESQL_SHARED_BUFFERS
                value: 512MB
              - name: WORK_MEM
                value: 128MB
        queryapi:
          arguments: 3
          - -v=3
    1
    You can apply resources to an indexer, database, queryapi, or collector pod.
    2
    You can add multiple environment variables in the envVar section to specify a value for each variable that you name.
    3
    You can control the log level verbosity for any of the previous four pods by adding the - -v=3 argument.

    See the following example where memory resources are applied to the indexer pod:

        indexer:
          resources:
            limits:
              memory: 5Gi
            requests:
              memory: 1Gi
  • You can define the node placement for search pods.

    You can update the Placement resource of search pods by using the nodeSelector parameter, or the tolerations parameter. View the following example configuration:

    spec:
     dbStorage:
      size: 10Gi
     deployments:
      collector: {}
      database: {}
      indexer: {}
      queryapi: {}
     nodeSelector:
      node-role.kubernetes.io/infra: ""
     tolerations:
     - effect: NoSchedule
      key: node-role.kubernetes.io/infra
      operator: Exists
  • Specify your search query by selecting the Advanced search drop-down button to filter the Column, Operator, and Value options or add a search constraint.

2.3. Search operations and data types

Specify your search query by using search operations as conditions. Characters such as >, >=, <, <=, != are supported. See the following search operation table:

Table 2.2. Search operation table
Default operationData typeDescription

=

string, number

This is the default operation.

! or !=

string, number

This represents the NOT operation, which means to exclude from the search results.

<, ⇐, >, >=

number

 

>

date

Dates matching the last hour, day, week, month, and year.

*

string

Partial string match.

Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.