监控
使用 Kindling 观测 Kubernetes 的网络连接
· ☕ 3 分钟
最近有一个需求,收集 Kubernetes 的外网访问情况。因此对相关项目进行了调用和试用,本篇主要是介绍如何安装 Kindling,配置 Grafana 查看 Kubernetes 网络连接数据。 1. 什么是 Kindling Kindling 解决的是,在不入侵应用的前提下,如何观测网络的问题,其功能主要是通过暴露内核事件来实现观测。

如何预估 Kubernetes 集群中监控组件的资源消耗
· ☕ 2 分钟
本文描述的监控指标,仅包含 Kubernetes 基础的指标,不包含业务相关指标,相关组件为 prometheus-server、kube-state-metrics、node-exporter,数据的保存周期为 3 天。 1. 集群中监控相关组件 1 2 3 4 helm -n monitor list NAME NAMESPACE REVISION UPDATED STATUS

常用的各类资源 Prometheus 告警语句
· ☕ 4 分钟
主机 主机内存使用率超过阈值 1 - node_memory_MemAvailable_bytes{mode!="idle"} / node_memory_MemTotal_bytes 阈值:0.9 主机 CPU 使用率超过阈值 1 - avg(irate(node_cpu_seconds_total{mode="idle"}[5m])) by (host_name) 阈值:0.85 主机硬盘使用率超过阈值 1 - avg without (fstype)(node_filesystem_free_bytes{fstype!='rootfs',mountpoint!~'/(run|var|snap).*'} / node_filesystem_size_bytes{fstype!='rootfs',mountpoint!~'/(run|var|snap).*'}) 阈值:0.8 Windows Windows 主机内存使用率超过阈值 1 - 1 * windows_os_physical_memory_free_bytes{job="windows_exporter",mode!="idle"} / windows_cs_physical_memory_bytes 阈值:0.9 Windows 主机 CPU 使用率超过阈值 1 - (avg by (host_ip,host_name) (irate(windows_cpu_time_total{job="windows_exporter",mode="idle"}[1m]))) 阈值:0.85

在 Kubernetes 集群上部署 Elasticsearch 栈
· ☕ 3 分钟
如果采用 Logstash 集中接收 Filebeat 的日志输入,容易造成单点瓶颈;如果采用 Kafka 接收 Filebeat 的日志输入,日志的时效性又得不到保障。这里直接将 Filebeat 采集的日志直接输出到 Elasticsearch。 1. 准备工作 节点规划 这里没有区分 master、data、client 节点,而是

使用 Blackbox Exporter 测试网络连通性
· ☕ 3 分钟
如果你需要监控两个主机、主机与外部服务之间的网络状况,那么就可以试一试本文提到的 Blackbox Exporter。 1. 安装 Blackbox 1.1 在主机上部署 下载二进制包 1 2 3 4 5 wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.21.0/blackbox_exporter-0.21.0.linux-amd64.tar.gz tar -xzvf blackbox_exporter-0.21.0.linux-amd64.tar.gz mv blackbox_exporter-0.21.0.linux-amd64/blackbox_exporter /usr/bin/ mkdir /etc/prometheus mv blackbox_exporter-0.21.0.linux-amd64/blackbox.yml /etc/prometheus/ 清理安装包 1 rm -rf blackbox_exporter-0.21.0.linux-amd64* 新建 Systemd 服务 1 vim /usr/lib/systemd/system/blackbox_exporter.service 新增如下内容: [Unit] Description=blackbox_exporter After=network.target [Service] Restart=on-failure ExecStart=/usr/bin/blackbox_exporter \ --config.file=/etc/prometheus/blackbox.yml Restart=on-failure [Install] WantedBy=multi-user.target