当前位置:网站首页>阿里kube-eventer mysql sink简单使用记录
阿里kube-eventer mysql sink简单使用记录
2022-06-30 20:20:00 【weixin_40455124】
阿里kube-eventer 可以将k8s event 直接插入mysql,根据github上的官方文档,设置sink如下:
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
就可以启动(ps,必须保证coredns正常)。
在mysql上创建db及表,注意表名也是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';
观测日志有如下类似输出:
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...
查看表有如下数据:
边栏推荐
- Based on the open source stream batch integrated data synchronization engine Chunjun data restore DDL parsing module actual combat sharing
- 1045 error occurred in MySQL login. Modification method [easy to understand]
- 北京大学ACM Problems 1003:Hangover
- 毕业设计
- Lumiprobe蛋白质定量丨QuDye 蛋白定量试剂盒
- Evolution of screen display technology
- 居家办公没有“血泪史”| 社区征文
- Originpro 2021 with installation tutorial
- Comparison between QT and other GUI Libraries
- Testing principle and precautions of biovendor rage ELISA Kit
猜你喜欢

树基本概念

RP原型资源分享-购物类App
![Jerry's touch key recognition process [chapter]](/img/3e/bb73c735d0a7c7a26989c65a432dad.png)
Jerry's touch key recognition process [chapter]
![翻转链表II[翻转链表3种方式+dummyHead/头插法/尾插法]](/img/a8/6472e2051a295f5e42a88d64199517.png)
翻转链表II[翻转链表3种方式+dummyHead/头插法/尾插法]

Lumiprobe biotin phosphimide (hydroxyproline) instructions

好高的佣金,《新程序员》合伙人计划来袭,人人皆可参与

Implementation principle of PostgreSQL heap table storage engine

maya房子建模

Testing principle and precautions of biovendor rage ELISA Kit

NLP skill tree learning route - (I) route overview
随机推荐
B_QuRT_User_Guide(32)
Web APIs 综合案例-Tab栏切换 丨黑马程序员
BioVendor sRAGE Elisa试剂盒测试原理和注意事项
Golang应用 ━━ 安装、配置与使用hugo博客系统
Huffman Tree (1) Basic Concept and C - language Implementation
Jenkins can't pull the latest jar package
Study on lumiprobe modified triphosphate biotin-11-utp
By analyzing more than 7million R & D needs, it is found that these eight programming languages are the most needed by the industry
Jerry's question about long press boot detection [chapter]
亚马逊在阿拉伯联合酋长国限制LGBTQ相关的搜索和产品销售
Go language identifier and package name specification
在线教育项目用户登录和注册
STL的基本组成部分
数据库 OLAP、OLTP是什么?相同和不同?适用场景
杰理之触摸按键识别流程【篇】
1045 error occurred in MySQL login. Modification method [easy to understand]
偏向锁/轻量锁/重级锁锁锁更健康,上锁解锁到底是怎么完成实现的
请指教在线开户需要什么银行卡?另外想问,现在在线开户安全么?
断点续传和下载原理分析
Jerry's touch key recognition process [chapter]