7.3. 配置集群日志记录
可以使用在 openshift-logging 项目中部署的 ClusterLogging 自定义资源(CR)来配置集群日志记录。
Cluster Logging Operator 会监控集群日志记录 CR 的更改,创建任何缺少的日志记录组件,并相应地调整日志记录部署。
集群日志记录 CR 基于 ClusterLogging 自定义资源定义 (CRD),后者定义完整的集群日志记录部署,包括日志记录堆栈中用于收集、存储和视觉化日志的所有组件。
ClusterLogging 自定义资源(CR)示例
apiVersion: logging.openshift.io/v1
kind: ClusterLogging
metadata:
creationTimestamp: '2019-03-20T18:07:02Z'
generation: 1
name: instance
namespace: openshift-logging
spec:
collection:
logs:
fluentd:
resources: null
type: fluentd
curation:
curator:
resources: null
schedule: 30 3 * * *
type: curator
logStore:
elasticsearch:
nodeCount: 3
redundancyPolicy: SingleRedundancy
resources:
limits:
cpu:
memory:
requests:
cpu:
memory:
storage: {}
type: elasticsearch
managementState: Managed
visualization:
kibana:
proxy:
resources: null
replicas: 1
resources: null
type: kibana
您可以对集群日志记录进行以下配置:
- 可以将集群日志记录置于非受管状态,使管理员能够完全掌控各个组件的配置和升级。
-
可以通过在
cluster-logging-operator部署中修改适当的环境变量,覆盖每个集群日志记录组件的镜像。 - 可以使用节点选择器为日志记录组件指定特定的节点。
7.3.1. 了解集群日志记录组件镜像 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
集群日志记录中有多个组件,各自通过一个或多个镜像实施。每个镜像都由 openshift-logging 项目的 cluster-logging-operator 部署中定义的环境变量指定的,并且不应更改。
您可以通过运行以下命令来查看镜像:
$ oc -n openshift-logging set env deployment/cluster-logging-operator --list | grep _IMAGE
ELASTICSEARCH_IMAGE=registry.redhat.io/openshift4/ose-logging-elasticsearch5:v4.3
FLUENTD_IMAGE=registry.redhat.io/openshift4/ose-logging-fluentd:v4.3
KIBANA_IMAGE=registry.redhat.io/openshift4/ose-logging-kibana5:v4.3
CURATOR_IMAGE=registry.redhat.io/openshift4/ose-logging-curator5:v4.3
OAUTH_PROXY_IMAGE=registry.redhat.io/openshift4/ose-oauth-proxy:v4.3
这些值可能视您的环境而异。
重要
日志记录路由由 Cluster Logging Operator 管理,用户无法修改它。