当前位置:网站首页>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 :
边栏推荐
- Reading notes of Clickhouse principle analysis and Application Practice (3)
- The Three Musketeers: One for All!
- Ssh server configuration file parameter permitrootlogin introduction
- CA I ah, how many times Oh, ah sentence IU home Oh 11111
- Go Web 编程入门: 一探优秀测试库 GoConvey
- Nacos部署及使用
- Clickhouse Native Monitoring item, System table Description
- pytorch geometric torch-scatter和torch-sparse安装报错问题解决
- 机器学习中如何使用数据集?
- 1-12 preliminary understanding of Express
猜你喜欢

布隆过滤器

The programmer's girlfriend gave me a fatigue driving test

Neurotransmetteurs excitateurs - glutamate et santé cérébrale

Prediction and regression of stacking integrated model

Rethink healthy diet based on intestinal microbiome

PostgreSQL存储结构浅析

It is urgent for enterprises to protect API security

Clickhouse Native Monitoring item, System table Description

兴奋神经递质——谷氨酸与大脑健康

【MySQL入门】第一话 · 初入“数据库”大陆
随机推荐
Sqlserver string type converted to decimal or integer type
Sqlserver gets the data of numbers, Chinese and characters in the string
Reading notes of Clickhouse principle analysis and Application Practice (2)
Dm8: generate DM AWR Report
Ml & DL: introduction to hyperparametric optimization in machine learning and deep learning, evaluation index, over fitting phenomenon, and detailed introduction to commonly used parameter adjustment
Nacos部署及使用
Clickhouse distributed table engine
【MySQL入门】第一话 · 初入“数据库”大陆
Pytorch quantitative perception training (qat) steps
The Jenkins download Plug-in can't be downloaded. Solution
周少剑,很少见
1-21 JSONP接口
Study summary of dynamic routing between capsules
Microservice link risk analysis
1-13 express监听GET和POST请求&处理请求
1-19 using CORS to solve interface cross domain problems
1-18 创建最基本的express服务器&创建路由的API模块
1-12 初步认识Express
Clickhouse native monitoring item, system table description
Pytorch quantitative practice (2)