配置

eBPF探针熔断

熔断原理

eBPF探针熔断策略是根据Node节点主机CPU使用率和可用内存大小来判断是否需要执行探针熔断。

  • CPU默认的阈值为 75%~85%,当Node节点CPU使用率超过85%,触发探针熔断。

  • 可用内存默认的阈值为1GB~2GB,当Node节点的可用内存小于1GB时,触发探针熔断。

  • 探针熔断后,当主机CPU使用率低于75%时且可用内存大于2GB时,探针恢复正常工作。

需要注意的是,熔断时eBPF探针进程会退出,熔断恢复后,eBPF探针进程会重新启动。

配置修改

修改tingyunagent.yaml中的tingyun-common-configebpf_cpu_blow_thresholdebpf_mem_blow_threshold

apiVersion: v1
kind: ConfigMap
metadata:
  name: tingyun-common-config
  namespace: tingyun
data:
  VERSION: |
    2.4.1.0
  tingyun-common.yaml: |
    #是否启用EBPF网络数据收集功能,true或false
    #如果开启EBPF功能,需要同时修改Daemonset tingyun-linux-agent的requests cpu为0.5, memory为1Gi,并重启Daemonset tingyun-linux-agent
    ebpf_enabled: false

    #EBPF网络模块按CPU使用率熔断阈值:启用阈值,禁用阈值
    #单位:百分比
    #当node节点的CPU使用率高于禁用阈值时,EBPF网络模块切换到熔断状态
    #当处于熔断状态,且CPU使用率低于CPU启用阈值时,且可用内存大于可用内存启用阈值时,启用EBPF网络模块
    ebpf_cpu_blow_threshold: 75,85

    #EBPF网络模块按可用内存大小熔断阈值:禁用阈值,启用阈值
    #单位:字节
    #当node节点的可用内存小于禁用阈值时,EBPF网络模块切换到熔断状态
    #当处于熔断状态,且CPU使用率低于CPU启用阈值时,且可用内存大于可用内存启用阈值时,启用EBPF网络模块
    ebpf_mem_blow_threshold: 1073741824,2147483648

然后使用yaml文件更新。

kubectl apply -f tingyunagent.yaml

当tingyunagent.yaml安装文件丢失时,可以使用edit configmap命令修改配置。

kubectl edit configmap tingyun-common-config -n tingyun

查看熔断日志:

kubectl -n tingyun exec -ti tingyun-linux-agent-vrtwk -- cat /opt/agent/ebpf/restart.log

输入结果类似如下:

ebpf agent stop, because of feature disable                  # ebpf_enabled开关为false
ebpf agent start, because of crash restart or blow recover   # ebpf_enabled开关为true,探针启动
ebpf agent stop, because of trigger cpu blow                 # cpu高导致熔断
ebpf agent start, because of crash restart or blow recover   # 熔断恢复,探针启动
ebpf agent stop, because of trigger memory blow              # 可用内存不足导致熔断
ebpf agent start, because of crash restart or blow recover   # 熔断恢复,探针启动
ebpf agent not start because of memory blow                  # 可用内存不足导致探针未启动

日志级别和审计模式

修改tingyunagent.yaml中的tingyun-sys-configebpf.conf文件内的配置项 log.levellog.audit

apiVersion: v1
kind: ConfigMap
metadata:
  name: tingyun-sys-config
  namespace: tingyun
data:
  ebpf.conf: |
    #
    # 配置项: log.filecount
    # 用途:   日志文件保留个数
    # 缺省值: 10
    # 修改后需要重启pod
    log.filecount=3
    # 
    # 配置项: log.filesize
    # 用途:   单个日志文件大小
    # 缺省值: 100
    # 单位:   MB字节
    # 修改后需要重启pod
    log.filesize=100
    # 
    # 配置项:  log.level
    # 用途:    日志数据过滤级别
    # 可设定值: debug, info, warning, error
    # 缺省值:  info
    # 修改后需要重启pod
    log.level=info
    #
    # 配置项:  log.audit
    # 用途:    开启审计模式日志
    # 可设定值: true, false
    # 缺省值:  false
    # 修改后需要重启pod
    log.audit=false

然后使用yaml文件更新。

kubectl apply -f tingyunagent.yaml

当tingyunagent.yaml安装文件丢失时,可以使用edit configmap命令修改配置。

kubectl edit configmap tingyun-sys-config -n tingyun

然后delete原有tingyun-linux-agent的pod,让pod重建。

kubectl -n tingyun delete pod tingyun-linux-agent-ddefb

查看工作日志:

kubectl -n tingyun exec -ti tingyun-linux-agent-vrtwk -- cat /opt/agent/ebpf/logs/ebpf-agent.log
© 2007-2023 北京基调网络股份有限公司 all right reserved,powered by Gitbook本文档更新于: 2024-04-19 15:02

results matching ""

    No results matching ""