6.4. 配置日志可视化工具

Red Hat OpenShift Service on AWS 使用 Kibana 显示 logging 子系统收集的日志数据。

您可以扩展 Kibana 来实现冗余性,并为 Kibana 节点配置 CPU 和内存。

6.4.1. 配置 CPU 和内存限值

logging 子系统组件允许对 CPU 和内存限值进行调整。

流程

  1. 编辑 openshift-logging 项目中的 ClusterLogging 自定义资源(CR):

    $ oc -n openshift-logging edit ClusterLogging instance
    apiVersion: "logging.openshift.io/v1"
    kind: "ClusterLogging"
    metadata:
      name: "instance"
      namespace: openshift-logging
    
    ...
    
    spec:
      managementState: "Managed"
      logStore:
        type: "elasticsearch"
        elasticsearch:
          nodeCount: 3
          resources: 1
            limits:
              memory: 16Gi
            requests:
              cpu: 200m
              memory: 16Gi
          storage:
            storageClassName: "gp2"
            size: "200G"
          redundancyPolicy: "SingleRedundancy"
      visualization:
        type: "kibana"
        kibana:
          resources: 2
            limits:
              memory: 1Gi
            requests:
              cpu: 500m
              memory: 1Gi
          proxy:
            resources: 3
              limits:
                memory: 100Mi
              requests:
                cpu: 100m
                memory: 100Mi
          replicas: 2
      collection:
        logs:
          type: "fluentd"
          fluentd:
            resources: 4
              limits:
                memory: 736Mi
              requests:
                cpu: 200m
                memory: 736Mi
    1
    根据需要指定日志存储的 CPU 和内存限值及请求。对于 Elasticsearch,您必须调整请求值和限制值。
    2 3
    根据需要为日志 visualizer 指定 CPU 和内存限值和请求。
    4
    根据需要指定日志收集器的 CPU 和内存限值及请求。

6.4.2. 为日志可视化器节点扩展冗余性

您可以扩展托管日志视觉化器的 pod 以增加它的冗余性。

流程

  1. 编辑 openshift-logging 项目中的 ClusterLogging 自定义资源(CR):

    $ oc edit ClusterLogging instance
    $ oc edit ClusterLogging instance
    
    apiVersion: "logging.openshift.io/v1"
    kind: "ClusterLogging"
    metadata:
      name: "instance"
    
    ....
    
    spec:
        visualization:
          type: "kibana"
          kibana:
            replicas: 1 1
    1
    指定 Kibana 节点的数量。