自定义资源标签

创建时间:2024-06-01 最近修改时间:2024-07-04

#1. K8s Label

DeepFlow 目前支持自动关联 K8s 自定义 Label 的资源包括:

  • 容器服务
  • 工作负载
    • Deployment
    • StatefulSet
    • DaemonSet
    • ReplicationController
    • CafeDeployment
    • CloneSet
  • ReplicaSet/InPlaceSet
  • Pod

#2. K8s Annotation

DeepFlow(仅企业版)目前支持自动关联 K8s 自定义 Annotation 的资源包括:

  • 容器服务
  • Pod

#3. K8s Env

DeepFlow(仅企业版)目前支持自动关联 K8s 自定义 Annotation 的资源包括:

  • Pod

#4. 云资源自定义标签

DeepFlow(仅企业版)目前支持自动关联云资源自定义标签的资源包括:

  • 云服务器

支持的公有云厂商包括:

  • Aliyun 阿里云
  • Tencent Cloud 腾讯云
  • Huawei Cloud 华为云

支持的私有云厂商包括:

  • 阿里专有云

#5. 自定义自动分组标签

DeepFlow 系统默认提供 auto_instance/auto_service 两个自动分组的标签:

  • auto_instance:自动根据 IP 或 进程 ID 识别对应的实例 Tag,系统设置了可识别的 Tag 及优先级(容器 POD > 进程 > 容器节点 > 其他 > IP )
Value DisplayName Description
0 Internet IP
1 云服务器
5 路由器
6 宿主机
9 DHCP 网关
10 容器 POD
11 容器服务
12 Redis
13 RDS
14 容器节点
15 负载均衡器
16 NAT 网关
120 进程
255 IP

generate from csv file: auto_instance_type.ch

  • auto_service:自动根据 IP 或 进程 ID 识别对应的服务 Tag,系统设置了可识别的 Tag 及优先级(容器服务 > 工作负载 > 进程 > 容器集群 > 其他 > IP)
    • 对比 auto_instance 来说,auto_service 去掉了 容器 POD,增加了容器服务工作负载等更能体现服务的 Tag。其中 容器服务识别的优先级高于工作负载,因此当一个 IP 既属于容器服务又属于工作负载时,会识别为容器服务
Value DisplayName Description
0 Internet IP
1 云服务器
5 路由器
6 宿主机
9 DHCP 网关
11 容器服务
12 Redis
13 RDS
14 容器节点
15 负载均衡器
16 NAT 网关
101 工作负载
102 服务
103 容器集群
120 进程
130 Deployment
131 StatefulSet
132 ReplicationController
133 DaemonSet
134 ReplicaSetController
135 CloneSet
255 IP

generate from csv file: auto_service_type.ch

DeepFlow 同时也支持自定义自动分组标签的能力,按需配置其需要识别的 Tag 及优先级即可,配置文档如下:

querier:
  auto-custom-tag:
    # The Name of Custom Tag
    # Note: Cannot use colon, space, or backquote.
    tag-name: auto_my_tag
    # The Value of Custom Tag
    # Note: Range of source tags for retrieving the field value. Each row of data will
    #   automatically use the first non-zero tag encountered from top to bottom as the
    #   value for the custom tag. Here you can enter any tags seen in the results of
    #   the `show tags from <table>` API.
    tag-values:
    - k8s.label.app
    - auto_service
1
2
3
4
5
6
7
8
9
10
11
12
13

上述定义的 $tag-name 标签使用上与 auto_instanceauto_service 基本一致,额外的限制如下:

  • 此处定义的 $tag-name 不能与 * 同时用于分组
  • 此处定义的 $tag-name 不能与定义中 $tag-values 所包含的 Tag 同时用于分组