监控相关
ZABBIX安装与使用
自动发现与自动注册
配置文件
分布式监控
zabbix_sender安装和使用
zabbix_get安装与使用
自定义监控
自动发现监控json
PERCONA插件
PERCONA多实例
日志监控
相关项目监控
监控MySQL
监控Haproxy
Fluentd日志监控
Grafana(可视化监控指标)
grafana地图插件
添加prometheus模板
开启HTTPS
添加zabbix插件
Grafana模板
正则表达式
Prometheus监控
安装与使用
Prometheus存储
服务发现
Prometheus标签
PromQL查询
PushGateway推送组件
AlertManager告警组件
告警规则rule
K8S监控(kube-state-metric/cadvisor)
探针监控(blackbox_exporter)
Node_export
Mysql_export
Redis-exporter
cloudeye-exporter【华为云监控】
RabbitMQ-exporter
K8S监控
本文档使用MrDoc发布
返回首页
-
+
K8S监控
2022年12月12日 12:02
admin
#事件监控 ##初始化mysql数据库 ####在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'; --- ##安装kube-eventer apiVersion: apps/v1 kind: Deployment metadata: labels: name: kube-eventer name: kube-eventer namespace: ops-monit #命名空间 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:PASS@tcp(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: ops-monit #命名空间 --- apiVersion: v1 kind: ServiceAccount metadata: name: kube-eventer namespace: ops-monit #命名空间 --- ##查看日志 ![](/media//202212/2022-12-12120207501099.png) --- ##查看数据库 ![](/media//202212/2022-12-12120229234741.png)
分享到: