Basic Resource Tags

Created:2024-06-01 Last Modified:2024-07-05

This document was translated by ChatGPT

#1. Cloud Resource Tags

DeepFlow currently supports resource information synchronization for the following public cloud providers:

  • AWS
  • Aliyun 阿里云
  • Baidu Cloud 百度云
  • Huawei Cloud 华为云
  • Microsoft Azure
  • QingCloud 青云
  • Tencent Cloud 腾讯云
  • Volcengine 火山引擎

The resource tag information that supports automatic injection includes:

  • Region
  • Availability Zone
  • Cloud Server
  • VPC
  • Subnet
  • Router
  • Security Group
  • NAT Gateway
  • Load Balancer
  • Peering Connection
  • Cloud Enterprise Network
  • RDS
  • Redis

#2. K8s Resource Tags

DeepFlow supports automatic injection of the following K8s resource information:

  • Cluster
  • Node
  • Namespace
  • Container Service
  • Ingress
  • Workload
    • Deployment
    • StatefulSet
    • DaemonSet
    • ReplicationController
    • CafeDeployment
    • CloneSet
  • ReplicaSet / InPlaceSet
  • Pod

#3. Dependent K8s API

DeepFlow will call (list & watch) the K8s apiserver to obtain key fields of the following types of resources. The value types of each field can be referenced from the output of the kubectl get XXX -o json command. Please make necessary adaptations when you modify the API of these resources.

You can also choose to implement a pseudo-deepflow-agent yourself to complete the synchronization of K8s resource tags, thereby avoiding direct access to the K8s apiserver by the deepflow-agent. See the documentation here.

#3.1 Necessary Fields of *v1.Node

{
  "metadata": {
    "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Unique Identifier
    "name": "xxxx" // Name
  },
  "status": {
    "addresses": [
      {
        "address": "x.x.x.x", // Node IP
        "type": "InternalIP"
      }
    ],
    "conditions": [
      {
        "reason": "KubeletReady", // Used to determine Node status
        "status": "True" // Used to determine Node status
      }
    ]
  },
  "spec": {
    "podCIDR": "x.x.x.x/x" // Used to get the POD Cidr used by the Node
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

#3.2 Necessary Fields of *v1.Namespace

{
  "metadata": {
    "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Unique Identifier
    "name": "xxxx" // Name
  }
}
1
2
3
4
5
6

#3.3 Necessary Fields of *v1.Deployment/StatefulSet/DaemonSet/ReplicationController

{
  "metadata": {
    "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Unique Identifier
    "name": "xxxx", // Name
    "namespace": "xxxx", // Name of the associated namespace
    "labels": {
      // labels, can upload an empty dictionary
      "key1": "value1"
    }
  },
  "spec": {
    "replicas": 1
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

#3.4 Necessary Fields of *v1.ReplicaSet

{
  "metadata": {
    "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Unique Identifier
    "name": "xxxx", // Name
    "namespace": "xxxx", // Name of the associated namespace
    "labels": {
      // labels, can upload an empty dictionary
      "key1": "value1"
    },
    "ownerReferences": {
      // Information about the associated workload
      "name": "xxxx",
      "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
  },
  "spec": {
    "replicas": 1
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

#3.5 Necessary Fields of *v1.Pod

{
  "metadata": {
    "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Unique Identifier
    "name": "xxxx", // Name
    "namespace": "xxxx", // Name of the associated namespace
    "labels": {
      // labels, can upload an empty dictionary if *v1.Service resource is not reported
      "key1": "value1"
    },
    "ownerReferences": [
      // Information about the associated workload
      {
        // Workload type
        // Currently supported: DaemonSet/Deployment/ReplicaSet/StatefulSet/ReplicationController
        "kind": "xxxx",
        "name": "xxxx",
        "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      }
    ],
    "creationTimestamp": "2024-04-29T10:02:38Z", // Creation time
    "generate_name": "xxxx" // Only required for StatefulSet Pods
  },
  "status": {
    "hostIP": "x.x.x.x", // Node IP
    "podIP": "x.x.x.x", // Pod IP
    "conditions": [
      // POD status
      {
        "type": "xxxx",
        "status": "xxxx"
      }
    ],
    "containerStatuses": [
      {
        "containerID": "containerd://xxxxxxxxxxxx..." // Identifier of the container in the POD
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

#3.6 Necessary Fields of *v1.Service

{
    "metadata": {
        "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Unique Identifier
        "name": "xxxx",                                // Name
        "namespace": "xxxx",                           // Name of the associated namespace
        "labels": {                                    // labels, can upload an empty dictionary
            "key1": "value1"
        }
    },
    "spec": {
        "clusterIP": "x.x.x.x",
        "ports": [
            {
                "name": "xxxx",
                "nodePort": xxxx,
                "port": xxxx,
                "protocol": "xxxx",
                "targetPort": xxxx
            }
        ],
        "selector": { // The selector contains label information, the service associates with the Pod through the labels in the selector
            "key": "value"
        },
        "type": "xxxx" // Currently supports NodePort and ClusterIP
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

#3.7 Necessary Fields of *v1beta1.Ingress

{
    "metadata": {
        "uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Unique Identifier
        "name": "xxxx",                                // Name
        "namespace": "xxxx"                            // Name of the associated namespace
    },
    "spec": {
        "rules": [ // Forwarding rules
            {
                "host": "", // Domain name
                "http": {   // Currently only supports HTTP protocol
                    "paths": [
                        {
                            "path": "",   // Path
                            "backend": {  // Backend service information
                                "service": {
                                    "name": "",
                                    "port": {
                                        "number": xxxx
                                    }
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29