第 7 章 配置日志部署
7.1. 集群日志记录自定义资源(CR)
要为 Red Hat OpenShift 配置日志记录子系统,您需要自定义 ClusterLogging
自定义资源(CR)。
7.1.1. 关于 ClusterLogging 自定义资源
要更改日志记录子系统环境,请创建并修改 ClusterLogging
自定义资源(CR)。
本文根据需要提供了有关创建或修改 CR 的说明。
以下示例显示了 logging 子系统的典型自定义资源。
ClusterLogging
自定义资源(CR)示例
apiVersion: "logging.openshift.io/v1" kind: "ClusterLogging" metadata: name: "instance" 1 namespace: "openshift-logging" 2 spec: managementState: "Managed" 3 logStore: type: "elasticsearch" 4 retentionPolicy: application: maxAge: 1d infra: maxAge: 7d audit: maxAge: 7d elasticsearch: nodeCount: 3 resources: limits: memory: 16Gi requests: cpu: 500m memory: 16Gi storage: storageClassName: "gp2" size: "200G" redundancyPolicy: "SingleRedundancy" visualization: 5 type: "kibana" kibana: resources: limits: memory: 736Mi requests: cpu: 100m memory: 736Mi replicas: 1 collection: 6 logs: type: "fluentd" fluentd: resources: limits: memory: 736Mi requests: cpu: 100m memory: 736Mi