当前位置:网站首页>Alibaba Kube eventer MySQL sink simple usage record
Alibaba Kube eventer MySQL sink simple usage record
2022-06-30 21:56:00 【weixin_ forty million four hundred and fifty-five thousand one 】
Ali kube-eventer Can be k8s event Directly inserted into the mysql, according to github Official document on , Set up sink as follows :
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: kube-eventer
name: kube-eventer
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: kube-eventer
template:
metadata:
labels:
app: kube-eventer
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
dnsPolicy: ClusterFirstWithHostNet
serviceAccount: kube-eventer
containers:
- image: registry.aliyuncs.com/acs/kube-eventer-amd64:v1.2.0-484d9cd-aliyun
name: kube-eventer
command:
- "/kube-eventer"
- "--source=kubernetes:https://kubernetes.default"
- --sink=mysql:?USER:[email protected](XXX.XXX.XX.XX:3306)/kube_eventer?charset=utf8
env:
# If TZ is assigned, set the TZ value as the time zone
- name: TZ
value: "Asia/Shanghai"
volumeMounts:
- name: localtime
mountPath: /etc/localtime
readOnly: true
- name: zoneinfo
mountPath: /usr/share/zoneinfo
readOnly: true
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 500m
memory: 250Mi
volumes:
- name: localtime
hostPath:
path: /etc/localtime
- name: zoneinfo
hostPath:
path: /usr/share/zoneinfo
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kube-eventer
rules:
- apiGroups:
- ""
resources:
- configmaps
- events
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kube-eventer
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kube-eventer
subjects:
- kind: ServiceAccount
name: kube-eventer
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kube-eventer
namespace: kube-system
You can start it (ps, Must ensure coredns normal ).
stay mysql To create a db And table , Note that the table name is also kube_eventer
create database kube_eventer;
use kube_eventer;
create table kube_eventer
(
id bigint(20) not null auto_increment primary key comment 'event primary key',
name varchar(64) not null default '' comment 'event name',
namespace varchar(64) not null default '' comment 'event namespace',
event_id varchar(64) not null default '' comment 'event_id',
type varchar(64) not null default '' comment 'event type Warning or Normal',
reason varchar(64) not null default '' comment 'event reason',
message text not null comment 'event message' ,
kind varchar(64) not null default '' comment 'event kind' ,
first_occurrence_time varchar(64) not null default '' comment 'event first occurrence time',
last_occurrence_time varchar(64) not null default '' comment 'event last occurrence time',
unique index event_id_index (event_id)
) ENGINE = InnoDB default CHARSET = utf8 comment ='Event info tables';
The observation log has the following similar output :
I0629 15:05:00.004229 1 mysql.go:77] Begin Insert Mysql Data ...
I0629 15:05:00.004619 1 mysql.go:78] Namespace: default, Kind: Pod, Name: ongdb-helm-ongdb-core-0, Type: Warning, Reason: BackOff, Message: Back-off restarting failed container, EventID: b322724a-bb09-4234-b0eb-005ed0143d4a, FirstOccurrenceTimestamp: 2022-06-26 08:42:31 +0800 CST, LastOccurrenceTimestamp: 2022-06-29 15:04:38 +0800 CST
I0629 15:05:00.035284 1 mysql.go:84] Insert Mysql Data Suc...
I0629 15:05:30.001436 1 manager.go:102] Exporting 1 events
I0629 15:05:30.001723 1 mysql.go:73] {
"metadata": {
"name": "ongdb-helm-ongdb-core-1.16fc04ea85c4a40d",
"namespace": "default",
"uid": "0148eb42-04e2-402f-b9c8-a24a2971dc5b",
"resourceVersion": "572316",
"creationTimestamp": "2022-06-26T00:42:48Z",
"managedFields": [
{
"manager": "kubelet",
"operation": "Update",
"apiVersion": "v1",
"time": "2022-06-26T00:42:48Z",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:count": {
},
"f:firstTimestamp": {
},
"f:involvedObject": {
},
"f:lastTimestamp": {
},
"f:message": {
},
"f:reason": {
},
"f:source": {
"f:component": {
},
"f:host": {
}
},
"f:type": {
}
}
}
]
},
"involvedObject": {
"kind": "Pod",
"namespace": "default",
"name": "ongdb-helm-ongdb-core-1",
"uid": "fc1b0af0-2565-46ea-858a-61dfa18d71d0",
"apiVersion": "v1",
"resourceVersion": "499557",
"fieldPath": "spec.containers{ongdb-helm-ongdb}"
},
"reason": "BackOff",
"message": "Back-off restarting failed container",
"source": {
"component": "kubelet",
"host": "ubuntu153"
},
"firstTimestamp": "2022-06-26T00:42:48Z",
"lastTimestamp": "2022-06-29T07:05:22Z",
"count": 865,
"type": "Warning",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
}
I0629 15:05:30.003652 1 mysql.go:77] Begin Insert Mysql Data ...
I0629 15:05:30.003689 1 mysql.go:78] Namespace: default, Kind: Pod, Name: ongdb-helm-ongdb-core-1, Type: Warning, Reason: BackOff, Message: Back-off restarting failed container, EventID: 0148eb42-04e2-402f-b9c8-a24a2971dc5b, FirstOccurrenceTimestamp: 2022-06-26 08:42:48 +0800 CST, LastOccurrenceTimestamp: 2022-06-29 15:05:22 +0800 CST
I0629 15:05:30.026776 1 mysql.go:84] Insert Mysql Data Suc...
Check the table for the following data :
边栏推荐
- Rethink healthy diet based on intestinal microbiome
- 本地浏览器打开远程服务器上的Jupyter Notebook/Lab以及常见问题&设置
- 激发新动能 多地发力数字经济
- Go Web 编程入门: 一探优秀测试库 GoConvey
- Nacos部署及使用
- Multi table operation - foreign key constraint
- 做一个 Scrollbar 的思考
- The Three Musketeers: One for All!
- Summary of errors reported when using YML file to migrate CONDA environment
- Document Layout Analysis: A Comprehensive Survey 2019论文学习总结
猜你喜欢

Windbg调试工具介绍

pytorch geometric torch-scatter和torch-sparse安装报错问题解决

PyTorch量化实践(2)

Do machine learning jobs require graduate students?

Ten security measures against unauthorized access attacks

漫谈Clickhouse Join

Usbcan analyzer's supporting can and canfd comprehensive test software lkmaster software solves engineers' can bus test problems

Jupyter notebook/lab switch CONDA environment

Installing jupyter notebook under Anaconda

On several key issues of digital transformation
随机推荐
ML&DL:機器學習和深度學習中超參數優化的簡介、評估指標、過擬合現象、常用的調參優化方法之詳細攻略
周少剑,很少见
Jupyter notebook/lab switch CONDA environment
1-21 jsonp interface
Clickhouse native monitoring item, system table description
艾芬医生事件解析
Introduction to go web programming: a probe into the excellent test library gocovey
Dm8: generate DM AWR Report
USBCAN分析仪的配套CAN和CANFD综合测试软件LKMaster软件解决工程师CAN总线测试难题
Jupyterbook clear console output
1-20 pre inspection request
Arcmap|assign values to different categories of IDS with the field calculator
Error reporting: internal error XFS_ WANT_ CORRUPTED_ GOTO at line 1635 of file fs/xfs/libxfs/xfs_ alloc. c.
興奮神經遞質——穀氨酸與大腦健康
Document layout analysis: a comprehensive survey 2019 paper learning summary
1-16 路由的概念
1-13 express listens to get and post requests & processes requests
Zhoushaojian, rare
《ClickHouse原理解析与应用实践》读书笔记(2)
Ten security measures against unauthorized access attacks