跳到主要内容

部署

Kubernetes UniAgent安装包

检查环境是否满足要求

首先检查Kubernetes的node节点(操作系统、可用CPU、可用内存、可用存储等)是否满足运行eBPF探针的最低要求。

  • Node节点内核版本:高于4.15.0版本

  • Node节点可用CPU: 1核以上

  • Node节点可用内存: 1GB以上

  • Node节点可用存储: 1GB以上

然后检查部署的kubernetes UniAgent版本。eBPF探针要求kubernetes UniAgent版本>=2.4.1.0 且平台需要开通Infra主机授权。默认情况下,eBPF探针功能是禁用的,需要手动开启。

开启eBPF探针

将tingyunagent.yaml中的tingyun-common-configebpf_enabled: false改为ebpf_enabled: true

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 #修改为true

修改tingyunagent.yaml中 Daemonset tingyun-linux-agent的requests cpu为0.5,memory为1GiB。

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: tingyun-linux-agent
namespace: tingyun
spec:
selector:
matchLabels:
vendor: tingyun
component: linux-agent
template:
spec:
containers:
- name: linux
image: tingyunagent/infra-agent:2.4.0.0
securityContext:
privileged: true
runAsUser: 0
resources:
limits:
cpu: "2"
memory: "2Gi"
requests:
cpu: "0.5" #修改cpu为0.5
memory: "1Gi" #修改memory为1Gi

然后使用yaml文件更新。

kubectl apply -f tingyunagent.yaml    

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

kubectl edit configmap tingyun-common-config -n tingyun

确认eBPF探针是否启动。在每个node节点上执行:

kubectl -n tingyun exec -ti tingyun-linux-agent-xxxxx -- ps -ef | grep ebpf_agent | grep -v grep

如果进程存在,则表示EBPF探针已运行。如果进程不存在,则表示EBPF探针未运行。

查看eBPF探针日志

eBPF探针日志保存在Daemonset tingyun-linux-agent的pod中/opt/agent/ebpf目录下。

查看工作日志:

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

查看熔断日志:

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