1、yaml
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: tke-event-watcher
rules:
- apiGroups:
- ''
resources:
- events
verbs:
- get
- list
- watch
- apiGroups:
- ''
resources:
- namespaces
verbs:
- get
- list
- watch
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: tke-event-watcher
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tke-event-watcher-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: tke-event-watcher
subjects:
- kind: ServiceAccount
name: tke-event-watcher
namespace: kube-system
---
apiVersion: v1
data:
fluentd.conf: |
<source>
@type tail
path /data/log/*
pos_file /data/pos
tag host.path.*
format json
read_from_head true
path_key path
</source>
<match **>
@type elasticsearch
host elknode.uat.gwmfc.com
port 9200
scheme http
index_name tke-event-source
log_es_400_reason true
type_name _doc
flush_interval 5s
<buffer>
flush_mode interval
retry_type exponential_backoff
total_limit_size 32MB
chunk_limit_size 1MB
chunk_full_threshold 0.8
@type file
path /var/log/td-agent/buffer/ccs.cluster.log_collector.buffer.audit-event-collector.host-path
overflow_action block
flush_interval 1s
flush_thread_burst_interval 0.01
chunk_limit_records 8000
</buffer>
</match>
kind: ConfigMap
metadata:
name: fluentd-config
namespace: kube-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: tke-persistent-event
k8s.kuboard.cn/name: tke-persistent-event
qcloud-app: tke-persistent-event
name: tke-persistent-event
namespace: kube-system
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: tke-persistent-event
qcloud-app: tke-persistent-event
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
k8s-app: tke-persistent-event
qcloud-app: tke-persistent-event
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists
containers:
- command:
- ./tke-event-watcher
image: registry.pro.gwmfc.com/library/tke-event-watcher:v0.1
imagePullPolicy: IfNotPresent
name: tke-persistent-event-watcher
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data/log
name: event-data
- image: registry.pro.gwmfc.com/library/tke-audit-collector:v1.10.0
imagePullPolicy: IfNotPresent
name: tke-persistent-event-fluentd
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /root
name: fluentd-config
- mountPath: /data/log
name: event-data
readOnly: true
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: qcloudregistrykey
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: tke-event-watcher
serviceAccountName: tke-event-watcher
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
volumes:
- configMap:
defaultMode: 420
name: fluentd-config
name: fluentd-config
- emptyDir: {}
name: event-data
2、镜像
见自己网盘链接
链接:https://pan.baidu.com/s/10sqlwGRK36M9Kb1_lnALuQ
提取码:8kz7
文档更新时间: 2023-11-23 09:36 作者:张尚