Kubernetes
Collect indicators, objects and log data of container and Kubernetes and report them to Guance.
Configuration¶
Preconditions¶
- At present, container supported Docker/Containerd/CRI-O runtime
- Docker v17.04 and above should be installed, Container v15.1 and above should be installed, CRI-O 1.20.1 and above should be installed.
- Collecting Kubernetes data requires the DataKit to be deployed as a DaemonSet.
Info
- Container collection supports both Docker and Containerd runtime Version-1.5.7, and both are enabled by default.
In the case of a pure Docker or Containerd environment, the DataKit can only be installed on the host machine.
Go to the conf.d/samples directory under the DataKit installation directory, copy container.conf.sample and name it container.conf. Examples are as follows:
# Container input plugin configuration
[inputs.container]
# Container runtime endpoints to connect to
endpoints = [
"unix:///var/run/docker.sock",
"unix:///var/run/containerd/containerd.sock",
"unix:///var/run/crio/crio.sock",
]
# Collection intervals (uncomment to customize)
# metric_collect_interval = "60s" # Default: 60s
# object_collect_interval = "5m" # Default: 5m
# logging_search_interval = "60s" # Default: 60s
# GKE Autopilot Cloud API mode. Authentication uses Workload Identity through
# the GKE metadata server; project, cluster, and location are auto-discovered.
# gcp_cloud_api_enabled = false
# Optional overrides for cross-project or non-standard collection:
# gcp_project_id = "my-project"
# gcp_cluster_name = "my-autopilot-cluster"
# gcp_cluster_location = "us-central1"
# Advanced feature overrides (both enabled by default):
# enable_gcp_cloud_monitoring = true
# enable_gcp_cloud_logging = true
# gcp_cloud_logging_lookback = "2m"
# gcp_cloud_logging_overlap = "2m"
# Feature toggles
enable_container_metric = true # Collect container metrics
enable_k8s_metric = true # Collect Kubernetes metrics
enable_pod_metric = false # Collect pod-specific metrics
enable_k8s_event = true # Collect Kubernetes events
enable_k8s_node_local = true # Enable node-local collection
enable_collect_k8s_job = true # Collect Kubernetes jobs
# Kubernetes label extraction as tags
# Specify label keys to extract as tags (containers use pod labels)
# Example: ["app", "name", "version"]
# extract_k8s_label_as_tags_v2 = []
# extract_k8s_label_as_tags_v2_for_metric = []
# Container log filtering (supports glob patterns)
container_include_log = [] # Include specific containers (empty = all)
container_exclude_log = ["image:*logfwd*", "image:*datakit*"] # Exclude containers by image pattern
# Pod metric filtering (supports glob patterns)
pod_include_metric = [] # Include specific pods (empty = all)
pod_exclude_metric = [] # Exclude specific pods
# Logging configuration
logging_enable_multiline = true # Enable multiline log detection
logging_auto_multiline_extra_patterns = [] # Additional multiline patterns
# Log field filtering
logging_field_white_list = [] # Only retain specified fields (empty = all fields)
# Log processing options
logging_remove_ansi_escape_codes = false # Remove ANSI escape codes from logs
logging_file_from_beginning = false # Start reading from beginning of log files
# Performance tuning
# logging_max_open_files = 500 # Maximum open files (-1 = unlimited)
# Source mapping for log collection
# Maps regex patterns to new source names
[inputs.container.logging_extra_source_map]
# ".*nginx.*" = "nginx_logs"
# ".*apache.*" = "apache_logs"
# Multiline configuration per source
# Define multiline patterns for specific log sources
[inputs.container.logging_source_multiline_map]
# "java_logs" = '''^\d{4}-\d{2}-\d{2}'''
# "python_logs" = '''^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}'''
# Global tags for all collected data
[inputs.container.tags]
# environment = "production"
# cluster = "main"
# region = "us-west-1"
Can be turned on by ConfigMap Injection Collector Configuration or Config ENV_DATAKIT_INPUTS .
Can also be turned on by environment variables, (needs to be added as the default collector in ENV_DEFAULT_ENABLED_INPUTS):
-
ENV_INPUT_CONTAINER_ENDPOINTS
Append to container endpoints
Type: List
input.conf:
endpointsExample: "
unix:///var/run/docker.sock,unix:///var/run/containerd/containerd.sock,unix:///var/run/crio/crio.sock" -
ENV_INPUT_CONTAINER_METRIC_COLLEC_INTERVAL
The metric collection interval
Type: Duration
input.conf:
metric_collec_intervalDefault: 60s
-
ENV_INPUT_CONTAINER_OBJECT_COLLEC_INTERVAL
The object collection interval
Type: Duration
input.conf:
object_collec_intervalDefault: 5m
-
ENV_INPUT_CONTAINER_LOGGING_SEARCH_INTERVAL
The time interval of log discovery, that is, how often logs are retrieved. If the interval is too long, some logs with short survival will be ignored
Type: Duration
input.conf:
logging_search_intervalDefault: 60s
-
ENV_INPUT_CONTAINER_G_C_P_CLOUD_A_P_I_ENABLED
Collect GKE container metrics and stdout/stderr logs through Google Cloud APIs
Type: Boolean
input.conf:
g_c_p_cloud_a_p_i_enabledDefault: false
-
ENV_INPUT_CONTAINER_G_C_P_PROJECT_ID
Optional Google Cloud project ID override; discovered from the GKE metadata server by default
Type: String
input.conf:
g_c_p_project_id -
ENV_INPUT_CONTAINER_G_C_P_CLUSTER_NAME
Optional GKE cluster name override; discovered from the GKE metadata server by default
Type: String
input.conf:
g_c_p_cluster_name -
ENV_INPUT_CONTAINER_G_C_P_CLUSTER_LOCATION
Optional GKE cluster region or zone override; discovered from the GKE metadata server by default
Type: String
input.conf:
g_c_p_cluster_location -
ENV_INPUT_CONTAINER_ENABLE_G_C_P_CLOUD_MONITORING
Advanced override to collect container metrics from Cloud Monitoring
Type: Boolean
input.conf:
enable_g_c_p_cloud_monitoringDefault: true
-
ENV_INPUT_CONTAINER_ENABLE_G_C_P_CLOUD_LOGGING
Advanced override to collect container stdout/stderr from Cloud Logging
Type: Boolean
input.conf:
enable_g_c_p_cloud_loggingDefault: true
-
ENV_INPUT_CONTAINER_G_C_P_CLOUD_LOGGING_LOOKBACK
Initial Cloud Logging lookback window
Type: Duration
input.conf:
g_c_p_cloud_logging_lookbackDefault: 2m
-
ENV_INPUT_CONTAINER_G_C_P_CLOUD_LOGGING_OVERLAP
Cloud Logging overlap window used to tolerate delayed entries
Type: Duration
input.conf:
g_c_p_cloud_logging_overlapDefault: 2m
-
ENV_INPUT_CONTAINER_G_C_P_CLOUD_LOGGING_STATE_FILE
File used to persist the Cloud Logging watermark and deduplication state
Type: String
input.conf:
g_c_p_cloud_logging_state_file -
ENV_INPUT_CONTAINER_ENABLE_CONTAINER_METRIC
Start container index collection
Type: Boolean
input.conf:
enable_container_metricDefault: true
-
ENV_INPUT_CONTAINER_ENABLE_K8S_METRIC
Start k8s index collection
Type: Boolean
input.conf:
enable_k8s_metricDefault: true
-
ENV_INPUT_CONTAINER_ENABLE_POD_METRIC
Turn on Pod index collection
Type: Boolean
input.conf:
enable_pod_metricDefault: false
-
ENV_INPUT_CONTAINER_ENABLE_K8S_EVENT
Enable event collection mode
Type: Boolean
input.conf:
enable_k8s_eventDefault: true
-
ENV_INPUT_CONTAINER_ENABLE_K8S_NODE_LOCAL
Enable sub-Node collection mode, where the DataKit deployed on each Node independently collects the resources of the current Node. Version-1.5.7 Need new
RABClinkType: Boolean
input.conf:
enable_k8s_node_localDefault: true
-
ENV_INPUT_CONTAINER_ENABLE_COLLECT_KUBE_JOB
Turn off collection of Kubernetes Job resources (including metrics data and object data)
Type: Boolean
input.conf:
enable_collect_kube_jobDefault: true
-
ENV_INPUT_CONTAINER_EXTRACT_K8S_LABEL_AS_TAGS_V2
Append the labels of the resource to the tag of the non-metric (like object, logging and change) data. Label keys should be specified, if there is only one key and it is an empty string (e.g. [""]), all labels will be added to the tag. The container will inherit the Pod labels. If the key of the label has the dot character, it will be changed to a horizontal line
Type: JSON
input.conf:
extract_k8s_label_as_tags_v2Example:
'["app","name"]' -
ENV_INPUT_CONTAINER_EXTRACT_K8S_LABEL_AS_TAGS_V2_FOR_METRIC
Append the labels of the resource to the tag of the metric data. Label keys should be specified, if there is only one key and it is an empty string (e.g. [""]), all labels will be added to the tag. The container will inherit the Pod labels. If the key of the label has the dot character, it will be changed to a horizontal line
Type: JSON
input.conf:
extract_k8s_label_as_tags_v2_for_metricExample:
'["app","name"]' -
ENV_INPUT_CONTAINER_CONTAINER_MAX_CONCURRENT
Maximum number of concurrency when collecting container data, recommended to be turned on only when the collection delay is large
Type: Int
input.conf:
container_max_concurrentDefault: cpu cores + 1
-
ENV_INPUT_CONTAINER_CONTAINER_INCLUDE_LOG
Include condition of container log, filtering with image
Type: List
input.conf:
container_include_logExample:
"image:pubrepo.jiagouyun.com/datakit/logfwd*" -
ENV_INPUT_CONTAINER_CONTAINER_EXCLUDE_LOG
Exclude condition of container log, filtering with image
Type: List
input.conf:
container_exclude_logExample:
"image:pubrepo.jiagouyun.com/datakit/logfwd*" -
ENV_INPUT_CONTAINER_POD_INCLUDE_METRIC
Include condition of pod metrics, filtering with namespace
Type: List
input.conf:
pod_include_metricExample:
"namespace:datakit*" -
ENV_INPUT_CONTAINER_POD_EXCLUDE_METRIC
Exclude condition of pod metrics, filtering with namespace
Type: List
input.conf:
pod_exclude_metricExample:
"namespace:kube-system" -
ENV_INPUT_CONTAINER_LOGGING_EXTRA_SOURCE_MAP
Log collection configures additional source matching, and the regular source will be renamed
Type: Map
input.conf:
logging_extra_source_mapExample:
source_regex*=new_source,regex*=new_source2 -
ENV_INPUT_CONTAINER_LOGGING_SOURCE_MULTILINE_MAP_JSON
Log collection with multiline configuration as specified by the source
Type: JSON
input.conf:
logging_source_multiline_mapExample:
'{"source_nginx":"^\d{4}", "source_redis":"^[A-Za-z_]"}' -
ENV_INPUT_CONTAINER_LOGGING_AUTO_MULTILINE_EXTRA_PATTERNS_JSON
Supplementary automatic multiline patterns for log collection, checked only after built-in rules do not match
Type: JSON
input.conf:
logging_auto_multiline_extra_patternsExample:
'["^\d{4}-\d{2}", "^[A-Za-z_]"]'Default: For more default rules, see doc
-
ENV_INPUT_CONTAINER_LOGGING_REMOVE_ANSI_ESCAPE_CODES
Remove
ansiescape codes and color characters, referred toansi-decodedocType: Boolean
input.conf:
logging_remove_ansi_escape_codesDefault: false
-
ENV_INPUT_CONTAINER_LOGGING_FILE_FROM_BEGINNING_THRESHOLD_SIZE
Decide whether or not to from_beginning based on the file size, if the file size is smaller than this value when the file is found, start the collection from the begin
Type: Int
input.conf:
logging_file_from_beginning_threshold_sizeDefault: 20,000,000
-
ENV_INPUT_CONTAINER_LOGGING_FILE_FROM_BEGINNING
Whether to collect logs from the begin of the file
Type: Boolean
input.conf:
logging_file_from_beginningDefault: false
-
ENV_INPUT_CONTAINER_LOGGING_MAX_OPEN_FILES
The maximum allowed number of open files. If it is set to -1, it means there is no limit.
Type: Int
input.conf:
logging_max_open_filesDefault: 500
-
ENV_INPUT_CONTAINER_LOGGING_FIELD_WHITE_LIST
"Only retain the fields specified in the whitelist."
Type: List
input.conf:
logging_field_white_listExample:
'["service","container_id"]' -
ENV_INPUT_CONTAINER_TAGS
Customize tags. If there is a tag with the same name in the configuration file, it will be overwritten
Type: Map
input.conf:
tagsExample:
tag1=value1,tag2=value2 -
ENV_INPUT_CONTAINER_ENABLE_AUTO_DISCOVERY_OF_PROMETHEUS_POD_ANNOTATIONS
Deprecated. Whether to turn on Prometheus Pod Annotations and collect metrics automatically
Type: Boolean
input.conf:
enable_auto_discovery_of_prometheus_pod_annotationsDefault: false
-
ENV_INPUT_CONTAINER_ENABLE_AUTO_DISCOVERY_OF_PROMETHEUS_SERVICE_ANNOTATIONS
Deprecated. Whether to turn on Prometheus Service Annotations and collect metrics automatically
Type: Boolean
input.conf:
enable_auto_discovery_of_prometheus_service_annotationsDefault: false
-
ENV_INPUT_CONTAINER_ENABLE_AUTO_DISCOVERY_OF_PROMETHEUS_POD_MONITORS
Deprecated. Whether to turn on automatic discovery of Prometheus PodMonitor CRD and collection of metrics, see [Prometheus-Operator CRD doc](kubernetes-prometheus-operator-crd
Type: Boolean
input.conf:
enable_auto_discovery_of_prometheus_pod_monitorsDefault: false
-
ENV_INPUT_CONTAINER_ENABLE_AUTO_DISCOVERY_OF_PROMETHEUS_SERVICE_MONITORS
Deprecated. Whether to turn on automatic discovery of Prometheus ServiceMonitor CRD and collection of metrics, see [Prometheus-Operator CRD doc](kubernetes-prometheus-operator-crd
Type: Boolean
input.conf:
enable_auto_discovery_of_prometheus_service_monitorsDefault: false
-
ENV_INPUT_CONTAINER_LOGGING_AUTO_MULTILINE_DETECTION
Deprecated. Whether the automatic multi-line mode is turned on for log collection; the applicable multi-line rules will be matched in the patterns list after it is turned on
Type: Boolean
input.conf:
logging_auto_multiline_detectionDefault: false
Additional description of environment variables:
-
ENV_INPUT_CONTAINER_TAGS: If there is a tag with the same name in the configuration file (container.conf), it will be overwritten by the configuration here.
-
ENV_INPUT_CONTAINER_LOGGING_EXTRA_SOURCE_MAP: Specifying the replacement source with the argument format
regular expression=new_source, which is replaced by new_source when a source matches the regular expression. If the replacement is successful, the source( Version-1.4.7)configured inannotations/labelsis no longer used. If you want to make an exact match, you need to use^and$to enclose the content. For example, if a regular expression is written asdatakit, it can not only match the worddatakit, but also matchdatakit123; Written as^datakit$, you can only matchdatakit. -
ENV_INPUT_CONTAINER_LOGGING_SOURCE_MULTILINE_MAP_JSON: Used to specify the mapping of source to multi-row configuration. If a log is not configured with
multiline_match, the correspondingmultiline_matchis found and used here based on its source. Because themultiline_matchvalue is a regular expression, it is more complex, so the value format is a JSON string that can be coded and compressed into a single line using json.cn.
Note
- Object data collection interval is 5 minutes and metric data collection interval is 20 seconds. Configuration is not supported for the time being.
- Acquired log has a maximum length of ~800KB per line (including after
multiline_matchprocessing), the excess will split into new logging lines.
GKE Autopilot Cloud API Mode¶
Version Requirement
Collecting container metrics, objects, and logs through Cloud APIs requires DataKit 2.3.0 or later.
GKE Autopilot does not allow mounting the container runtime socket and host directories. Use the datakit-gke-autopilot chart, which deploys DataKit as a Deployment and collects data through Cloud APIs. See GCP GKE Autopilot Integration for installation, configuration, and capabilities.
Docker and Containerd Sock File Configuration¶
If the sock path of Docker or Containerd is not the default, you need to specify the sock file path. According to different deployment methods of DataKit, the methods are different. Take Containerd as an example:
Modify the containerd_address configuration entry of container.conf to set it to the corresponding sock path.
Change datakit.yaml, mount the directory that contains the socket into DataKit, and configure ENV_INPUT_CONTAINER_ENDPOINTS:
# add envs
- env:
- name: ENV_INPUT_CONTAINER_ENDPOINTS
value: '["unix:///path/to/new/containerd/containerd.sock"]'
# mount the directory that contains the socket
- mountPath: /path/to/new/containerd
name: containerd-run
readOnly: true
# modify volumes
volumes:
- hostPath:
path: /path/to/new/containerd
type: Directory
name: containerd-run
Prefer mounting the directory that contains the socket. Avoid subPath or mounting only the socket file. A container runtime may delete and recreate its socket during restart. A directory mount exposes the new file to DataKit, while a single-file mount may continue to reference the stale file.
Environment Variables ENV_INPUT_CONTAINER_ENDPOINTS is added to the existing endpoints configuration, and the actual endpoints configuration may have many items. The collector will remove duplicates and connect and collect them one by one.
The default endpoints configuration is:
endpoints = [
"unix:///var/run/docker.sock",
"unix:///var/run/containerd/containerd.sock",
"unix:///var/run/crio/crio.sock",
]
Using Environment Variables ENV_INPUT_CONTAINER_ENDPOINTS is["unix:///path/to/new//run/containerd.sock"],The final endpoints configuration is as follows:
endpoints = [
"unix:///var/run/docker.sock",
"unix:///var/run/containerd/containerd.sock",
"unix:///var/run/crio/crio.sock",
"unix:///path/to/new//run/containerd.sock",
]
The collector will connect and collect these containers during runtime. If the sock file does not exist, an error log will be output when the first connection fails, which does not affect subsequent collection.
Node Failure Recovery¶
When DataKit runs as a DaemonSet, it accesses the container runtime on each node to discover containers and manage log collection tasks. A node, containerd, or kubelet failure can interrupt container discovery and log collection. In exceptional cases, the DataKit process remains running after node recovery while container collection does not recover.
DataKit provides the following safeguards and recovery behavior:
- If the container runtime is not ready when DataKit starts, DataKit keeps retrying. It also rebuilds the connection after runtime communication failures. Once the dependency recovers, container discovery and log collection resume without restarting DataKit.
- The independent
/v1/healthendpoint reports component health without relying on Prometheus metrics or log keywords. - DataKit continues self-recovery after a container runtime connection failure and does not restart immediately. Health fails after recovery keeps failing for two minutes or no state is reported for ten minutes. By default, the DaemonSet liveness probe checks every 15 seconds and restarts DataKit after four consecutive failures.
/v1/pingonly confirms that the main process is running and does not prove that container log collection is healthy.
Use the current stable release and validate node restart, containerd restart, and kubelet restart scenarios after upgrading. Ensure the runtime endpoint matches the DaemonSet directory mount. If the issue recurs, preserve a Bug Report before the Pod restarts and collect the node runtime logs and failure time range.
Prometheus Exporter Metrics Collection¶
If the Pod/container has exposed Prometheus metrics, there are two ways to collect them, see here.
Log Collection¶
See here for the relevant configuration of log collection.
Metric¶
For all of the following data collections, a global tag named host is appended by default (the tag value is the host name of the DataKit), or other tags can be specified in the configuration by [inputs.container.tags]:
kube_statefulset¶
The metric of the Kubernetes StatefulSet.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| statefulset ( tag) |
Name must be unique within a namespace. |
| uid ( tag) |
The UID of StatefulSet. |
| replicas | The number of Pods created by the StatefulSet controller. Type: int | (gauge) Unit: count |
| replicas_available | Total number of available pods (ready for at least minReadySeconds) targeted by this StatefulSet. Type: int | (gauge) Unit: count |
| replicas_current | The number of Pods created by the StatefulSet controller from the StatefulSet version indicated by currentRevision. Type: int | (gauge) Unit: count |
| replicas_desired | The desired number of replicas of the given Template. Type: int | (gauge) Unit: count |
| replicas_ready | The number of pods created for this StatefulSet with a Ready Condition. Type: int | (gauge) Unit: count |
| replicas_updated | The number of Pods created by the StatefulSet controller from the StatefulSet version indicated by updateRevision. Type: int | (gauge) Unit: count |
kube_replicaset¶
The metric of the Kubernetes ReplicaSet.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| replicaset ( tag) |
Name must be unique within a namespace. |
| uid ( tag) |
The UID of ReplicaSet. |
| fully_labeled_replicas | The number of fully labeled replicas per ReplicaSet. Type: int | (gauge) Unit: count |
| replicas | The most recently observed number of replicas. Type: int | (gauge) Unit: count |
| replicas_available | The number of available replicas (ready for at least minReadySeconds) for this replica set. Type: int | (gauge) Unit: count |
| replicas_desired | The number of desired replicas. Type: int | (gauge) Unit: count |
| replicas_ready | The number of ready replicas for this replica set. Type: int | (gauge) Unit: count |
kube_service¶
The metric of the Kubernetes Service.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| service ( tag) |
Name must be unique within a namespace. |
| uid ( tag) |
The UID of Service |
| ports | Total number of ports that are exposed by this service. Type: int | (gauge) Unit: count |
kube_pod¶
The metric of the Kubernetes Pod.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| daemonset ( tag) |
The name of the DaemonSet which the object belongs to. |
| deployment ( tag) |
The name of the Deployment which the object belongs to. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| node_name ( tag) |
NodeName is a request to schedule this pod onto a specific node. |
| pod ( tag) |
Name must be unique within a namespace. |
| pod_name ( tag) |
Renamed from 'pod'. |
| statefulset ( tag) |
The name of the StatefulSet which the object belongs to. |
| uid ( tag) |
The UID of pod. |
| cpu_limit_millicores | The total CPU limit (in millicores) across all containers in this Pod. Note: This value is the sum of all container limit values, as Pods do not have a direct limit value. Type: int | (gauge) Unit: milli-cores |
| cpu_number | The total number of CPUs on the node where the Pod is running. Type: int | (gauge) Unit: count |
| cpu_request_millicores | The total CPU request (in millicores) across all containers in this Pod. Note: This value is the sum of all container request values, as Pods do not have a direct request value. Type: int | (gauge) Unit: milli-cores |
| cpu_usage | The total CPU usage across all containers in this Pod. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base100 | The normalized CPU usage, with a maximum of 100%. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base_limit | The normalized CPU usage, with a maximum of 100%, based on the CPU limit. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base_request | The normalized CPU usage, with a maximum of 100%, based on the CPU request. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_millicores | The total CPU usage (in millicores) averaged over the sample window for all containers. Type: int | (gauge) Unit: milli-cores |
| ephemeral_storage_available_bytes | The storage space available (bytes) for the filesystem. Type: int | (gauge) Unit: digital,B |
| ephemeral_storage_capacity_bytes | The total capacity (bytes) of the filesystems underlying storage. Type: int | (gauge) Unit: digital,B |
| ephemeral_storage_used_bytes | The bytes used for a specific task on the filesystem. Type: int | (gauge) Unit: digital,B |
| mem_capacity | The total memory capacity of the host machine. Type: int | (gauge) Unit: digital,B |
| mem_limit | The total memory limit across all containers in this Pod. Note: This value is the sum of all container limit values, as Pods do not have a direct limit value. Type: int | (gauge) Unit: digital,B |
| mem_request | The total memory request across all containers in this Pod. Note: This value is the sum of all container request values, as Pods do not have a direct request value. Type: int | (gauge) Unit: digital,B |
| mem_rss | The total RSS memory usage of all containers in this Pod, which is not supported by metrics-server. Type: int | (gauge) Unit: digital,B |
| mem_usage | The total memory usage of all containers in this Pod. Type: int | (gauge) Unit: digital,B |
| mem_used_percent | The percentage of memory usage based on the host machine’s total memory capacity. Type: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_limit | The percentage of memory usage based on the memory limit. Type: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_request | The percentage of memory usage based on the memory request. Type: float | (gauge) Unit: percent,percent |
| memory_capacity | The total memory in the host machine (Deprecated use mem_capacity).Type: int | (gauge) Unit: digital,B |
| memory_usage_bytes | The sum of the memory usage of all containers in this Pod (Deprecated use mem_usage).Type: int | (gauge) Unit: digital,B |
| memory_used_percent | The percentage usage of the memory (refer from mem_used_percentType: float | (gauge) Unit: percent,percent |
| network_bytes_rcvd | Cumulative count of bytes received. Type: int | (gauge) Unit: digital,B |
| network_bytes_sent | Cumulative count of bytes transmitted. Type: int | (gauge) Unit: digital,B |
| ready | Describes whether the pod is ready to serve requests. Type: int | (gauge) Unit: count |
| restarts | The number of times the container has been restarted. Type: int | (gauge) Unit: count |
kubernetes¶
The count of the Kubernetes resource.
| Tags & Fields | Description |
|---|---|
| namespace ( tag) |
namespace |
| node_name ( tag) |
NodeName is a request to schedule this pod onto a specific node (only supported Pod and Container). |
| container | Number of containers in the selected Kubernetes scope. Type: int | (count) Unit: count |
| cronjob | Number of Kubernetes CronJobs in the selected scope. Type: int | (count) Unit: count |
| daemonset | Number of Kubernetes DaemonSets in the selected scope. Type: int | (count) Unit: count |
| deployment | Number of Kubernetes Deployments in the selected scope. Type: int | (count) Unit: count |
| endpoint | Number of Kubernetes Endpoints in the selected scope. Type: int | (count) Unit: count |
| job | Number of Kubernetes Jobs in the selected scope. Type: int | (count) Unit: count |
| node | Number of Kubernetes Nodes in the selected scope. Type: int | (count) Unit: count |
| pod | Number of Kubernetes Pods in the selected scope. Type: int | (count) Unit: count |
| replicaset | Number of Kubernetes ReplicaSets in the selected scope. Type: int | (count) Unit: count |
| service | Number of Kubernetes Services in the selected scope. Type: int | (count) Unit: count |
| statefulset | Number of Kubernetes StatefulSets in the selected scope. Type: int | (count) Unit: count |
kube_cronjob¶
The metric of the Kubernetes CronJob.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| cronjob ( tag) |
Name must be unique within a namespace. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of CronJob. |
| spec_suspend | This flag tells the controller to suspend subsequent executions. Type: bool | (bool) Unit: bool |
kube_daemonset¶
The metric of the Kubernetes DaemonSet.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| daemonset ( tag) |
Name must be unique within a namespace. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of DaemonSet. |
| daemons_available | The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and available (ready for at least spec.minReadySeconds). Type: int | (gauge) Unit: count |
| daemons_unavailable | The number of nodes that should be running the daemon pod and have none of the daemon pod running and available (ready for at least spec.minReadySeconds). Type: int | (gauge) Unit: count |
| desired | The total number of nodes that should be running the daemon pod (including nodes correctly running the daemon pod). Type: int | (gauge) Unit: count |
| misscheduled | The number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. Type: int | (gauge) Unit: count |
| ready | The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready. Type: int | (gauge) Unit: count |
| scheduled | The number of nodes that are running at least one daemon pod and are supposed to run the daemon pod. Type: int | (gauge) Unit: count |
| updated | The total number of nodes that are running updated daemon pod. Type: int | (gauge) Unit: count |
kube_deployment¶
The metric of the Kubernetes Deployment.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| deployment ( tag) |
Name must be unique within a namespace. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of Deployment. |
| replicas | Total number of non-terminated pods targeted by this deployment (their labels match the selector). Type: int | (gauge) Unit: count |
| replicas_available | Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. Type: int | (gauge) Unit: count |
| replicas_desired | Number of desired pods for a Deployment. Type: int | (gauge) Unit: count |
| replicas_ready | The number of pods targeted by this Deployment with a Ready Condition. Type: int | (gauge) Unit: count |
| replicas_unavailable | Total number of unavailable pods targeted by this deployment. Type: int | (gauge) Unit: count |
| replicas_updated | Total number of non-terminated pods targeted by this deployment that have the desired template spec. Type: int | (gauge) Unit: count |
| rollingupdate_max_surge | The maximum number of pods that can be scheduled above the desired number of pods. Type: int | (gauge) Unit: count |
| rollingupdate_max_unavailable | The maximum number of pods that can be unavailable during the update. Type: int | (gauge) Unit: count |
kube_dfpv¶
The metric of the Kubernetes PersistentVolume.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| name ( tag) |
The dfpv name, consists of pvc name and pod name |
| namespace ( tag) |
The namespace of Pod and PVC. |
| node_name ( tag) |
Reference to the Node. |
| pod_name ( tag) |
Reference to the Pod. |
| pvc_name ( tag) |
Reference to the PVC. |
| volume_mount_name ( tag) |
The name given to the Volume. |
| available | AvailableBytes represents the storage space available (bytes) for the filesystem. Type: int | (gauge) Unit: digital,B |
| capacity | CapacityBytes represents the total capacity (bytes) of the filesystems underlying storage. Type: int | (gauge) Unit: digital,B |
| inodes | Inodes represents the total inodes in the filesystem. Type: int | (gauge) Unit: count |
| inodes_free | InodesFree represents the free inodes in the filesystem. Type: int | (gauge) Unit: count |
| inodes_used | InodesUsed represents the inodes used by the filesystem. Type: int | (gauge) Unit: count |
| used | UsedBytes represents the bytes used for a specific task on the filesystem. Type: int | (gauge) Unit: digital,B |
kube_endpoint¶
The metric of the Kubernetes Endpoints.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| endpoint ( tag) |
Name must be unique within a namespace. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of Endpoint. |
| address_available | Number of addresses available in endpoint. Type: int | (gauge) Unit: count |
| address_not_ready | Number of addresses not ready in endpoint. Type: int | (gauge) Unit: count |
kube_job¶
The metric of the Kubernetes Job.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| job ( tag) |
Name must be unique within a namespace. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of Job. |
| active | The number of actively running pods. Type: int | (gauge) Unit: count |
| completion_failed | The job has failed its execution. Type: int | (gauge) Unit: count |
| completion_succeeded | The job has completed its execution. Type: int | (gauge) Unit: count |
| failed | The number of pods which reached phase Failed. Type: int | (gauge) Unit: count |
| succeeded | The number of pods which reached phase Succeeded. Type: int | (gauge) Unit: count |
kube_node¶
The metric of the Kubernetes Node.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| node ( tag) |
Name must be unique within a namespace |
| uid ( tag) |
The UID of Node. |
| cpu_allocatable | Allocatable CPU cores on this node that are available for scheduling. Type: int | (gauge) Unit: N/A |
| cpu_capacity | Total CPU capacity of this node in cores. Type: int | (gauge) Unit: N/A |
| ephemeral_storage_allocatable | Allocatable ephemeral storage in bytes on this node that is available for scheduling. Type: int | (gauge) Unit: digital,B |
| ephemeral_storage_capacity | Total ephemeral storage capacity of this node in bytes. Type: int | (gauge) Unit: digital,B |
| memory_allocatable | Allocatable memory in bytes on this node that is available for scheduling. Type: int | (gauge) Unit: digital,B |
| memory_capacity | Total memory capacity of this node in bytes. Type: int | (gauge) Unit: digital,B |
| pods_allocatable | Maximum number of pods that can be scheduled on this node. Type: int | (gauge) Unit: count |
| pods_capacity | Total pod capacity configured for this node. Type: int | (gauge) Unit: count |
docker_containers¶
The metric of containers, only supported Running status.
| Tags & Fields | Description |
|---|---|
| aws_ecs_cluster_name ( tag) |
Cluster name of the AWS ECS. |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| container_id ( tag) |
Container ID |
| container_name ( tag) |
Container name from k8s (label io.kubernetes.container.name). If empty then use $container_runtime_name. |
| container_runtime ( tag) |
Container runtime (this container from Docker/Containerd/cri-o). |
| container_runtime_name ( tag) |
Container name from runtime (like 'docker ps'). If empty then use 'unknown'. |
| container_runtime_version ( tag) |
Container runtime version. |
| container_type ( tag) |
The type of the container (this container is created by Kubernetes/Docker/Containerd/cri-o). |
| daemonset ( tag) |
The name of the DaemonSet which the object belongs to. |
| deployment ( tag) |
The name of the Deployment which the object belongs to. |
| gcp_location ( tag) |
GKE cluster region or zone (GKE Autopilot Cloud API mode). |
| gcp_project_id ( tag) |
Google Cloud project ID (GKE Autopilot Cloud API mode). |
| host ( tag) |
The node where the container is located. |
| image ( tag) |
The full name of the container image, example nginx.org/nginx:1.21.0. |
| namespace ( tag) |
The namespace of the container (label io.kubernetes.pod.namespace). |
| pod_name ( tag) |
The pod name of the container (label io.kubernetes.pod.name). |
| pod_uid ( tag) |
The pod uid of the container (label io.kubernetes.pod.uid). |
| state ( tag) |
Container status (only Running). |
| statefulset ( tag) |
The name of the StatefulSet which the object belongs to. |
| task_arn ( tag) |
The task arn of the AWS Fargate. |
| task_family ( tag) |
The task family of the AWS fargate. |
| task_version ( tag) |
The task version of the AWS fargate. |
| block_read_byte | Total number of bytes read from the container file system (only supported docker). Type: int | (gauge) Unit: digital,B |
| block_write_byte | Total number of bytes wrote to the container file system (only supported docker). Type: int | (gauge) Unit: digital,B |
| cpu_limit_millicores | The CPU limit of the container, measured in milli-cores. Type: int | (gauge) Unit: milli-cores |
| cpu_numbers | The number of CPU cores on the system host. Type: int | (gauge) Unit: count |
| cpu_request_millicores | The CPU request of the container, measured in milli-cores (only supported in Kubernetes). Type: int | (gauge) Unit: milli-cores |
| cpu_usage | The actual CPU usage on the system host (percentage). Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base100 | The normalized CPU usage, with a maximum value of 100%. It is calculated as the number of CPU cores multiplied by 100. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base_limit | The CPU usage based on the CPU limit (percentage). Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base_request | The CPU usage based on the CPU request (percentage) (only supported in Kubernetes). Type: float | (gauge) Unit: percent,percent |
| cpu_usage_millicores | The CPU usage of the container, measured in milli-cores. Type: int | (gauge) Unit: milli-cores |
| mem_capacity | The total memory on the system host. Type: int | (gauge) Unit: digital,B |
| mem_limit | The memory limit of the container. Type: int | (gauge) Unit: digital,B |
| mem_request | The memory request of the container (only supported in Kubernetes). Type: int | (gauge) Unit: digital,B |
| mem_usage | The actual memory usage of the container. Type: int | (gauge) Unit: digital,B |
| mem_used_percent | The memory usage percentage based on the total memory of the system host. Type: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_limit | The memory usage percentage based on the memory limit. Type: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_request | The memory usage percentage based on the memory request (only supported in Kubernetes). Type: float | (gauge) Unit: percent,percent |
| network_bytes_rcvd | Total number of bytes received from the network (only count the usage of the main process in the container, excluding loopback). Type: int | (gauge) Unit: digital,B |
| network_bytes_sent | Total number of bytes send to the network (only count the usage of the main process in the container, excluding loopback). Type: int | (gauge) Unit: digital,B |
Object¶
kubernetes_statefulsets¶
The object of the Kubernetes StatefulSet.
| Tags & Fields | Description |
|---|---|
| <ALL-SELECTOR-MATCH-LABELS> ( tag) |
Represents the selector.matchLabels for Kubernetes resources |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| name ( tag) |
The UID of StatefulSet. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| statefulset_name ( tag) |
Name must be unique within a namespace. |
| uid ( tag) |
The UID of StatefulSet. |
| workload_name ( tag) |
The name of the workload resource. |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| replicas | The number of Pods created by the StatefulSet controller. Type: int | (gauge) Unit: count |
| replicas_available | Total number of available pods (ready for at least minReadySeconds) targeted by this StatefulSet. Type: int | (gauge) Unit: count |
| replicas_current | The number of Pods created by the StatefulSet controller from the StatefulSet version indicated by currentRevision. Type: int | (gauge) Unit: count |
| replicas_desired | The desired number of replicas of the given Template. Type: int | (gauge) Unit: count |
| replicas_ready | The number of pods created for this StatefulSet with a Ready Condition. Type: int | (gauge) Unit: count |
| replicas_updated | The number of Pods created by the StatefulSet controller from the StatefulSet version indicated by updateRevision. Type: int | (gauge) Unit: count |
kubernetes_replica_sets¶
The object of the Kubernetes ReplicaSet.
| Tags & Fields | Description |
|---|---|
| <ALL-SELECTOR-MATCH-LABELS> ( tag) |
Represents the selector.matchLabels for Kubernetes resources |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| deployment ( tag) |
The name of the Deployment which the object belongs to. |
| name ( tag) |
The UID of ReplicaSet. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| replicaset_name ( tag) |
Name must be unique within a namespace. |
| statefulset ( tag) |
The name of the StatefulSet which the object belongs to. |
| uid ( tag) |
The UID of ReplicaSet. |
| workload_name ( tag) |
The name of the workload resource. |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| available | Deprecated alias for the number of available replicas in this ReplicaSet. Type: int | (gauge) Unit: count |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| ready | Deprecated alias for the number of ready replicas in this ReplicaSet. Type: int | (gauge) Unit: count |
| replicas | The most recently observed number of replicas. Type: int | (gauge) Unit: count |
| replicas_available | The number of available replicas (ready for at least minReadySeconds) for this replica set. Type: int | (gauge) Unit: count |
| replicas_desired | The number of desired replicas. Type: int | (gauge) Unit: count |
| replicas_ready | The number of ready replicas for this replica set. Type: int | (gauge) Unit: count |
kubernetes_services¶
The object of the Kubernetes Service.
| Tags & Fields | Description |
|---|---|
| <ALL-SELECTOR> ( tag) |
Represents the selector for Kubernetes resources |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| name ( tag) |
The UID of Service |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| service_name ( tag) |
Name must be unique within a namespace. |
| type ( tag) |
Type determines how the Service is exposed. Defaults to ClusterIP. (ClusterIP/NodePort/LoadBalancer/ExternalName) |
| uid ( tag) |
The UID of Service |
| workload_name ( tag) |
The name of the workload resource. |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| cluster_ip | ClusterIP is the IP address of the service and is usually assigned randomly by the master. Type: string | (string) Unit: N/A |
| external_ips | ExternalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. Type: string | (string) Unit: N/A |
| external_name | ExternalName is the external reference that kubedns or equivalent will return as a CNAME record for this service. Type: string | (string) Unit: N/A |
| external_traffic_policy | ExternalTrafficPolicy denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints. Type: string | (string) Unit: N/A |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| session_affinity | Supports "ClientIP" and "None". Type: string | (string) Unit: N/A |
kubelet_pod¶
The object of the Kubernetes Pod.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| daemonset ( tag) |
The name of the DaemonSet which the object belongs to. |
| deployment ( tag) |
The name of the Deployment which the object belongs to. |
| host ( tag) |
Pointing to the node where the pod is located. |
| name ( tag) |
The UID of Pod. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| node_name ( tag) |
NodeName is a request to schedule this pod onto a specific node. |
| phase ( tag) |
The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle.(Pending/Running/Succeeded/Failed/Unknown) |
| pod_name ( tag) |
Name must be unique within a namespace. |
| qos_class ( tag) |
The Quality of Service (QOS) classification assigned to the pod based on resource requirements |
| statefulset ( tag) |
The name of the StatefulSet which the object belongs to. |
| status ( tag) |
Reason the container is not yet running. |
| uid ( tag) |
The UID of Pod. |
| workload_name ( tag) |
The name of the workload resource. |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| available | Number of containers Type: int | (gauge) Unit: count |
| cpu_limit_millicores | The total CPU limit (in millicores) across all containers in this Pod. Note: This value is the sum of all container limit values, as Pods do not have a direct limit value. Type: int | (gauge) Unit: milli-cores |
| cpu_number | The total number of CPUs on the node where the Pod is running. Type: int | (gauge) Unit: count |
| cpu_request_millicores | The total CPU request (in millicores) across all containers in this Pod. Note: This value is the sum of all container request values, as Pods do not have a direct request value. Type: int | (gauge) Unit: milli-cores |
| cpu_usage | The total CPU usage across all containers in this Pod. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base100 | The normalized CPU usage, with a maximum of 100%. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base_limit | The normalized CPU usage, with a maximum of 100%, based on the CPU limit. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base_request | The normalized CPU usage, with a maximum of 100%, based on the CPU request. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_millicores | The total CPU usage (in millicores) averaged over the sample window for all containers. Type: int | (gauge) Unit: milli-cores |
| ephemeral_storage_available_bytes | The storage space available (bytes) for the filesystem. Type: int | (gauge) Unit: digital,B |
| ephemeral_storage_capacity_bytes | The total capacity (bytes) of the filesystems underlying storage. Type: int | (gauge) Unit: digital,B |
| ephemeral_storage_used_bytes | The bytes used for a specific task on the filesystem. Type: int | (gauge) Unit: digital,B |
| mem_capacity | The total memory capacity of the host machine. Type: int | (gauge) Unit: digital,B |
| mem_limit | The total memory limit across all containers in this Pod. Note: This value is the sum of all container limit values, as Pods do not have a direct limit value. Type: int | (gauge) Unit: digital,B |
| mem_request | The total memory request across all containers in this Pod. Note: This value is the sum of all container request values, as Pods do not have a direct request value. Type: int | (gauge) Unit: digital,B |
| mem_rss | The total RSS memory usage of all containers in this Pod, which is not supported by metrics-server. Type: int | (gauge) Unit: digital,B |
| mem_usage | The total memory usage of all containers in this Pod. Type: int | (gauge) Unit: digital,B |
| mem_used_percent | The percentage of memory usage based on the host machine’s total memory capacity. Type: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_100 | The percentage usage of the memory (refer from mem_used_percentType: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_limit | The percentage of memory usage based on the memory limit. Type: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_request | The percentage of memory usage based on the memory request. Type: float | (gauge) Unit: percent,percent |
| memory_capacity | The total memory in the host machine (Deprecated use mem_capacity).Type: int | (gauge) Unit: digital,B |
| memory_usage_bytes | The sum of the memory usage of all containers in this Pod (Deprecated use mem_usage).Type: int | (gauge) Unit: digital,B |
| memory_used_percent | The percentage usage of the memory (refer from mem_used_percentType: float | (gauge) Unit: percent,percent |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| network_bytes_rcvd | Cumulative count of bytes received. Type: int | (gauge) Unit: digital,B |
| network_bytes_sent | Cumulative count of bytes transmitted. Type: int | (gauge) Unit: digital,B |
| ready | Describes whether the pod is ready to serve requests. Type: int | (gauge) Unit: count |
| restarts | The number of times the container has been restarted. Type: int | (gauge) Unit: count |
kubernetes_persistentvolumeclaims¶
The object of the Kubernetes PersistentVolumeClaim.
| Tags & Fields | Description |
|---|---|
| <ALL-SELECTOR-MATCH-LABELS> ( tag) |
Represents the selector.matchLabels for Kubernetes resources |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| name ( tag) |
The UID of PersistentVolume. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| persistentvolumeclaim_name ( tag) |
Name must be unique within a namespace. |
| uid ( tag) |
The UID of PersistentVolume. |
| workload_name ( tag) |
The name of the workload resource. |
| access_modes | AccessModes contains the desired access modes the volume should have. Type: string | (string) Unit: N/A |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| phase | The phase indicates if a volume is available, bound to a claim, or released by a claim.(Pending/Bound/Lost) Type: string | (string) Unit: N/A |
| requests_storage | Specifies the maximum storage capacity of a PersistentVolume (PV), which Kubernetes uses for scheduling and resource allocation. Type: string | (string) Unit: N/A |
| storage_class_name | StorageClassName is the name of the StorageClass required by the claim. Type: string | (string) Unit: N/A |
| volume_mode | VolumeMode defines what type of volume is required by the claim.(Block/Filesystem) Type: string | (string) Unit: N/A |
| volume_name | VolumeName is the binding reference to the PersistentVolume backing this claim. Type: string | (string) Unit: N/A |
kubernetes_persistentvolumes¶
The object of the Kubernetes PersistentVolume.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| name ( tag) |
The UID of PersistentVolume. |
| persistentvolume_name ( tag) |
The name of PersistentVolume |
| uid ( tag) |
The UID of PersistentVolume. |
| workload_name ( tag) |
The name of the workload resource. |
| access_modes | AccessModes contains the desired access modes the volume should have. Type: string | (string) Unit: N/A |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| capacity_storage | Specifies the maximum storage capacity of a PersistentVolume (PV), which Kubernetes uses for scheduling and resource allocation. Type: string | (string) Unit: N/A |
| claimRef_name | Name of the bound PersistentVolumeClaim. Type: string | (string) Unit: N/A |
| claimRef_namespace | Namespace of the PersistentVolumeClaim. Type: string | (string) Unit: N/A |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| phase | The phase indicates if a volume is available, bound to a claim, or released by a claim.(Pending/Available/Bound/Released/Failed) Type: string | (string) Unit: N/A |
kubernetes_cron_jobs¶
The object of the Kubernetes CronJob.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| cron_job_name ( tag) |
Name must be unique within a namespace. |
| name ( tag) |
The UID of CronJob. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of CronJob. |
| workload_name ( tag) |
The name of the workload resource. |
| active_jobs | The number of pointers to currently running jobs. Type: int | (gauge) Unit: count |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| schedule | The schedule in Cron format, see doc Type: string | (string) Unit: N/A |
| suspend | This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Type: bool | (bool) Unit: bool |
kubernetes_daemonset¶
The object of the Kubernetes DaemonSet.
| Tags & Fields | Description |
|---|---|
| <ALL-SELECTOR-MATCH-LABELS> ( tag) |
Represents the selector.matchLabels for Kubernetes resources |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| daemonset_name ( tag) |
Name must be unique within a namespace. |
| name ( tag) |
The UID of DaemonSet. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of DaemonSet. |
| workload_name ( tag) |
The name of the workload resource. |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| daemons_available | The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and available (ready for at least spec.minReadySeconds). Type: int | (gauge) Unit: count |
| daemons_unavailable | The number of nodes that should be running the daemon pod and have none of the daemon pod running and available (ready for at least spec.minReadySeconds). Type: int | (gauge) Unit: count |
| desired | The total number of nodes that should be running the daemon pod (including nodes correctly running the daemon pod). Type: int | (gauge) Unit: count |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| misscheduled | The number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. Type: int | (gauge) Unit: count |
| ready | The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready. Type: int | (gauge) Unit: count |
| scheduled | The number of nodes that are running at least one daemon pod and are supposed to run the daemon pod. Type: int | (gauge) Unit: count |
| updated | The total number of nodes that are running updated daemon pod. Type: int | (gauge) Unit: count |
kubernetes_deployments¶
The object of the Kubernetes Deployment.
| Tags & Fields | Description |
|---|---|
| <ALL-SELECTOR-MATCH-LABELS> ( tag) |
Represents the selector.matchLabels for Kubernetes resources |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| deployment_name ( tag) |
Name must be unique within a namespace. |
| name ( tag) |
The UID of Deployment. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of Deployment. |
| workload_name ( tag) |
The name of the workload resource. |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| available | Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. (Deprecated) Type: int | (gauge) Unit: count |
| max_surge | The maximum number of pods that can be scheduled above the desired number of pods. (Deprecated) Type: int | (gauge) Unit: count |
| max_unavailable | The maximum number of pods that can be unavailable during the update. (Deprecated) Type: int | (gauge) Unit: count |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| paused | Indicates that the deployment is paused (true or false). Type: bool | (bool) Unit: bool |
| ready | The number of pods targeted by this Deployment with a Ready Condition. (Deprecated) Type: int | (gauge) Unit: count |
| replicas | Total number of non-terminated pods targeted by this deployment (their labels match the selector). Type: int | (gauge) Unit: count |
| replicas_available | Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. Type: int | (gauge) Unit: count |
| replicas_desired | Number of desired pods for a Deployment. Type: int | (gauge) Unit: count |
| replicas_ready | The number of pods targeted by this Deployment with a Ready Condition. Type: int | (gauge) Unit: count |
| replicas_unavailable | Total number of unavailable pods targeted by this deployment. Type: int | (gauge) Unit: count |
| replicas_updated | Total number of non-terminated pods targeted by this deployment that have the desired template spec. Type: int | (gauge) Unit: count |
| rollingupdate_max_surge | The maximum number of pods that can be scheduled above the desired number of pods. Type: int | (gauge) Unit: count |
| rollingupdate_max_unavailable | The maximum number of pods that can be unavailable during the update. Type: int | (gauge) Unit: count |
| strategy | Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. Type: string | (string) Unit: N/A |
| unavailable | Total number of unavailable pods targeted by this deployment. (Deprecated) Type: int | (gauge) Unit: count |
| up_dated | Total number of non-terminated pods targeted by this deployment that have the desired template spec. (Deprecated) Type: int | (gauge) Unit: count |
kubernetes_dfpv¶
The object of the Kubernetes PersistentVolume.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| name ( tag) |
The dfpv name, consists of pvc name and pod name |
| namespace ( tag) |
The namespace of Pod and PVC. |
| node_name ( tag) |
Reference to the Node. |
| pod_name ( tag) |
Reference to the Pod. |
| pvc_name ( tag) |
Reference to the PVC. |
| volume_mount_name ( tag) |
The name given to the Volume. |
| available | AvailableBytes represents the storage space available (bytes) for the filesystem. Type: int | (gauge) Unit: digital,B |
| capacity | CapacityBytes represents the total capacity (bytes) of the filesystems underlying storage. Type: int | (gauge) Unit: digital,B |
| inodes | Inodes represents the total inodes in the filesystem. Type: int | (gauge) Unit: count |
| inodes_free | InodesFree represents the free inodes in the filesystem. Type: int | (gauge) Unit: count |
| inodes_used | InodesUsed represents the inodes used by the filesystem. Type: int | (gauge) Unit: count |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| used | UsedBytes represents the bytes used for a specific task on the filesystem. Type: int | (gauge) Unit: digital,B |
kubernetes_jobs¶
The object of the Kubernetes Job.
| Tags & Fields | Description |
|---|---|
| <ALL-SELECTOR-MATCH-LABELS> ( tag) |
Represents the selector.matchLabels for Kubernetes resources |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| job_name ( tag) |
Name must be unique within a namespace. |
| name ( tag) |
The UID of Job. |
| namespace ( tag) |
Namespace defines the space within each name must be unique. |
| uid ( tag) |
The UID of Job. |
| workload_name ( tag) |
The name of the workload resource. |
| active | The number of actively running pods. Type: int | (gauge) Unit: count |
| active_deadline | Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it Type: int | (gauge) Unit: time,s |
| age | Age (seconds) Type: int | (gauge) Unit: time,s |
| backoff_limit | Specifies the number of retries before marking this job failed. Type: int | (gauge) Unit: count |
| completions | Specifies the desired number of successfully finished pods the job should be run with. Type: int | (gauge) Unit: count |
| failed | The number of pods which reached phase Failed. Type: int | (gauge) Unit: count |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| parallelism | Specifies the maximum desired number of pods the job should run at any given time. Type: int | (gauge) Unit: count |
| succeeded | The number of pods which reached phase Succeeded. Type: int | (gauge) Unit: count |
kubernetes_nodes¶
The object of the Kubernetes Node.
| Tags & Fields | Description |
|---|---|
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| internal_ip ( tag) |
Node internal IP |
| name ( tag) |
The UID of Node. |
| node_name ( tag) |
Name must be unique within a namespace. |
| role ( tag) |
Node role. (master/node) |
| status ( tag) |
NodePhase is the recently observed lifecycle phase of the node. (Pending/Running/Terminated) |
| uid ( tag) |
The UID of Node. |
| workload_name ( tag) |
The name of the workload resource. |
| age | Age (seconds). Type: int | (gauge) Unit: time,s |
| kubelet_version | Kubelet Version reported by the node. Type: string | (string) Unit: N/A |
| message | Serialized Kubernetes object details for this resource. Type: string | (string) Unit: N/A |
| node_ready | NodeReady means kubelet is healthy and ready to accept pods (true/false/unknown). Type: string | (string) Unit: N/A |
| taints | Node's taints. Type: string | (string) Unit: N/A |
| unschedulable | Unschedulable controls node schedulability of new pods (yes/no). Type: string | (string) Unit: N/A |
docker_containers¶
The object of containers, only supported Running status.
| Tags & Fields | Description |
|---|---|
| aws_ecs_cluster_name ( tag) |
Cluster name of the AWS ECS. |
| cluster_name_k8s ( tag) |
K8s cluster name(default is default). We can rename it in datakit.yaml on ENV_CLUSTER_NAME_K8S. |
| container_id ( tag) |
Container ID. |
| container_name ( tag) |
Container name from k8s (label io.kubernetes.container.name). If empty then use $container_runtime_name. |
| container_runtime ( tag) |
Container runtime (this container from Docker/Containerd/cri-o). |
| container_runtime_name ( tag) |
Container name from runtime (like 'docker ps'). If empty then use 'unknown'. |
| container_runtime_version ( tag) |
Container runtime version. |
| container_type ( tag) |
The type of the container (this container is created by Kubernetes/Docker/Containerd/cri-o). |
| daemonset ( tag) |
The name of the DaemonSet which the object belongs to. |
| deployment ( tag) |
The name of the Deployment which the object belongs to. |
| gcp_location ( tag) |
GKE cluster region or zone (GKE Autopilot Cloud API mode). |
| gcp_project_id ( tag) |
Google Cloud project ID (GKE Autopilot Cloud API mode). |
| host ( tag) |
The node where the container is located. |
| image ( tag) |
The full name of the container image, example nginx.org/nginx:1.21.0. |
| name ( tag) |
The ID of the container. |
| namespace ( tag) |
The namespace of the container (label io.kubernetes.pod.namespace). |
| pod_name ( tag) |
The pod name of the container (label io.kubernetes.pod.name). |
| pod_uid ( tag) |
The pod uid of the container (label io.kubernetes.pod.uid). |
| state ( tag) |
The state of the Container (only Running). |
| statefulset ( tag) |
The name of the StatefulSet which the object belongs to. |
| status ( tag) |
The status of the container,example Up 5 hours. |
| task_arn ( tag) |
The task arn of the AWS Fargate. |
| task_family ( tag) |
The task family of the AWS fargate. |
| task_version ( tag) |
The task version of the AWS fargate. |
| workload_name ( tag) |
The name of the workload resource. |
| age | Age (seconds). Type: int | (gauge) Unit: time,s |
| block_read_byte | Total number of bytes read from the container file system (only supported docker). Type: int | (gauge) Unit: digital,B |
| block_write_byte | Total number of bytes wrote to the container file system (only supported docker). Type: int | (gauge) Unit: digital,B |
| cpu_limit_millicores | The CPU limit of the container, measured in milli-cores. Type: int | (gauge) Unit: milli-cores |
| cpu_numbers | The number of CPU cores on the system host. Type: int | (gauge) Unit: count |
| cpu_request_millicores | The CPU request of the container, measured in milli-cores (only supported in Kubernetes). Type: int | (gauge) Unit: milli-cores |
| cpu_usage | The actual CPU usage on the system host (percentage). Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base100 | The normalized CPU usage, with a maximum value of 100%. It is calculated as the number of CPU cores multiplied by 100. Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base_limit | The CPU usage based on the CPU limit (percentage). Type: float | (gauge) Unit: percent,percent |
| cpu_usage_base_request | The CPU usage based on the CPU request (percentage) (only supported in Kubernetes). Type: float | (gauge) Unit: percent,percent |
| cpu_usage_millicores | The CPU usage of the container, measured in milli-cores. Type: int | (gauge) Unit: milli-cores |
| mem_capacity | The total memory on the system host. Type: int | (gauge) Unit: digital,B |
| mem_limit | The memory limit of the container. Type: int | (gauge) Unit: digital,B |
| mem_request | The memory request of the container (only supported in Kubernetes). Type: int | (gauge) Unit: digital,B |
| mem_usage | The actual memory usage of the container. Type: int | (gauge) Unit: digital,B |
| mem_used_percent | The memory usage percentage based on the total memory of the system host. Type: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_limit | The memory usage percentage based on the memory limit. Type: float | (gauge) Unit: percent,percent |
| mem_used_percent_base_request | The memory usage percentage based on the memory request (only supported in Kubernetes). Type: float | (gauge) Unit: percent,percent |
| message | Serialized container object details collected from the runtime and orchestration metadata. Type: string | (string) Unit: N/A |
| network_bytes_rcvd | Total number of bytes received from the network (only count the usage of the main process in the container, excluding loopback). Type: int | (gauge) Unit: digital,B |
| network_bytes_sent | Total number of bytes send to the network (only count the usage of the main process in the container, excluding loopback). Type: int | (gauge) Unit: digital,B |
Logs¶
kubernetes_events¶
The logging of the Kubernetes Event.
| Tags & Fields | Description |
|---|---|
| reason ( tag) |
This should be a short, machine understandable string that gives the reason, for the transition into the object's current status. |
| type ( tag) |
Type of this event. |
| uid ( tag) |
The UID of event. |
| involved_kind | Kind of the referent for involved object. Type: string | (string) Unit: N/A |
| involved_name | Name must be unique within a namespace for involved object. Type: string | (string) Unit: N/A |
| involved_namespace | Namespace defines the space within which each name must be unique for involved object. Type: string | (string) Unit: N/A |
| involved_uid | The UID of involved object. Type: string | (string) Unit: N/A |
| message | Details of event log Type: string | (string) Unit: N/A |
| source_component | Component from which the event is generated. Type: string | (string) Unit: N/A |
| source_host | Node name on which the event is generated. Type: string | (string) Unit: N/A |
<CONTAINER-NAME>¶
The logging of the container.
| Tags & Fields | Description |
|---|---|
| container_id ( tag) |
Container ID. |
| container_name ( tag) |
Container name from k8s (label io.kubernetes.container.name). If empty then use $container_runtime_name. |
| daemonset ( tag) |
The name of the DaemonSet which the object belongs to. |
| deployment ( tag) |
The name of the Deployment which the object belongs to. |
| filepath ( tag) |
The filepath to the log file on the host system where the log is stored. |
| gcp_location ( tag) |
GKE cluster region or zone (GKE Autopilot Cloud API mode). |
| gcp_project_id ( tag) |
Google Cloud project ID (GKE Autopilot Cloud API mode). |
| host ( tag) |
Host name |
| image ( tag) |
The full name of the container image, example nginx.org/nginx:1.21.0. |
| inside_filepath ( tag) |
The path to the log file inside the container (only applicable for log collection from within containers). |
| namespace ( tag) |
The namespace of the container (label io.kubernetes.pod.namespace). |
| pod_ip ( tag) |
The pod ip of the container. |
| pod_name ( tag) |
The pod name of the container (label io.kubernetes.pod.name). |
| service ( tag) |
The name of the service, if service is empty then use source. |
| statefulset ( tag) |
The name of the StatefulSet which the object belongs to. |
| stream ( tag) |
Container log stream, stdout or stderr. |
| gcp_insert_id | Cloud Logging insert ID (GKE Autopilot Cloud API mode). Type: string | (string) Unit: N/A |
| log_file_inode | The inode of the log file, which uniquely identifies it on the file system (requires enabling the global configuration enable_debug_fields).Type: int | (gauge) Unit: count |
| log_read_lines | The lines of the read file. Type: int | (gauge) Unit: count |
| log_read_offset | The current offset in the log file where reading has occurred, used to track progress during log collection (requires enabling the global configuration enable_debug_fields).Type: int | (gauge) Unit: count |
| message | Container log message text. Type: string | (string) Unit: N/A |
| status | Log record status, defaulting to info.Type: string | (string) Unit: N/A |
Change Events¶
event¶
Changes to major Kubernetes resources (Pods/Deployments/Services) will trigger change events with the following tag and fields. For the complete list of change events, see here.
| Tags & Fields | Description |
|---|---|
| class ( tag) |
The type of Kubernetes resource, e.g. kubernetes_deployments/kubernetes_nodes/.. |
| deployment_name/node_name/.. ( tag) |
The name of Kubernetes resource, e.g. deployment-abc-123 |
| df_event_id ( tag) |
The event ID is generated by UUIDv4, e.g. event-<lowercase UUIDv4>. |
| df_source ( tag) |
The event source is always change. |
| df_status ( tag) |
The event source is always info. |
| df_sub_status ( tag) |
Always info. |
| namespace ( tag) |
The namespace of Kubernetes resource. |
| uid ( tag) |
The UID of Kubernetes resource. |
| df_message | This is a template field, concatenated from other values: [{{df_resource_type}}] {{df_resource}} configuration changed.Type: string | (unknown) Unit: N/A |
| df_title | Title text summarizing the Kubernetes resource change. Type: string | (unknown) Unit: N/A |
| diff | Serialized diff text showing the Kubernetes resource changes. Type: string | (unknown) Unit: N/A |
Link Dataway Sink Function¶
Dataway Sink see documentation.
All collected Kubernetes resources will have a Label that matches the CustomerKey. For example, if the CustomerKey is name, DaemonSets, Deployments, Pods, and other resources will search for name in their own current Labels and add it to tags.
Containers will add Customer Labels of the Pods they belong to.
FAQ¶
Filtering Metrics Collection by Pod Namespace¶
When Kubernetes Pod metrics collection is enabled (enable_pod_metric = true), DataKit will collect metrics data for all Pods in the cluster. Since this can result in a large volume of data, you can filter the metrics collection by the Pod's namespace field to only collect metrics from Pods in specific namespaces.
You can control which Pods are included or excluded from metrics collection by configuring pod_include_metric and pod_exclude_metric.
## Collect metrics for Pods whose namespace matches `datakit`
pod_include_metric = ["namespace:datakit"]
## Exclude all Pods with namespace `kodo`
pod_exclude_metric = ["namespace:kodo"]
- Both
includeandexcludesettings must start with a field name, formatted as a glob pattern:"<field name>:<glob rule>". - Currently, only the
namespacefield is supported for filtering, e.g.,namespace:datakit-ns.
If both include and exclude are configured, the Pod must meet the following conditions:
- It must satisfy the
includerule - It must not satisfy the
excluderule
For example, the following configuration will filter out all Pods:
In a Kubernetes environment, you can configure the following environment variables:
ENV_INPUT_CONTAINER_POD_INCLUDE_METRICENV_INPUT_CONTAINER_POD_EXCLUDE_METRIC
For example, if you want to collect metrics only for Pods in the kube-system namespace, you can set the ENV_INPUT_CONTAINER_POD_INCLUDE_METRIC environment variable as shown below:
- env:
- name: ENV_INPUT_CONTAINER_POD_INCLUDE_METRIC
value: namespace:kube-system # Specify the namespace to collect metrics from
By using this method, you can flexibly control the range of Pods from which DataKit collects metrics, reducing the collection of unnecessary data and optimizing system performance and resource usage.
NODE_LOCAL Mode Requires New RBAC Permissions¶
The ENV_INPUT_CONTAINER_ENABLE_K8S_NODE_LOCAL mode is only recommended for DaemonSet deployment and requires access to kubelet, so the nodes/stats permission needs to be added to RBAC. For example:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: datakit
rules:
- apiGroups: [""]
resources: ["nodes", "nodes/stats"]
verbs: ["get", "list", "watch"]
In addition, the DataKit Pod needs to have the hostNetwork: true configuration item enabled.
Collect PersistentVolumes and PersistentVolumeClaims Requires New Permissions¶
DataKit version 1.25.0 Version-1.25.0 supported the collection of object data for Kubernetes PersistentVolume and PersistentVolumeClaim, which require new RBAC permissions, as described below:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: datakit
rules:
- apiGroups: [""]
resources: ["persistentvolumes", "persistentvolumeclaims"]
verbs: ["get", "list", "watch"]
Kubernetes Object YAML Field Filtering¶
When DataKit collects Kubernetes object data, it retrieves and stores the YAML configurations of the corresponding resources. To reduce storage usage, improve transmission efficiency, and avoid including unnecessary or sensitive information, DataKit performs field filtering on the original YAML.
Types of Filtered Fields:
-
Status Field: Removes the
statusfield from all resources, as it contains runtime status information calculated by the cluster, not user-defined configuration content, and is ignored duringkubectl apply. -
System-generated Metadata: Removes the following automatically generated metadata fields:
metadata.creationTimestampmetadata.resourceVersionmetadata.uidmetadata.generationmetadata.managedFields
-
Specific Annotations: Filters out annotations with the following prefixes. These are typically operational annotations automatically added by platform management tools (such as
Rancher,ArgoCD,Flux, etc.) and do not contain business configuration information:
argocd.argoproj.io/*
cattle.io/*
field.cattle.io/*
fluxcd.io/*
rancher.io/*
kubectl.kubernetes.io/*
nginx.ingress.kubernetes.io/*
Kubernetes YAML Sensitive Field Mask¶
DataKit collects yaml configurations for resources such as Kubernetes Pod or Service and stores them in the yaml field of the object data. If the yaml contains sensitive data (such as passwords), DataKit does not support manually configuring and shielding sensitive fields for the time being. It is recommended to use Kubernetes' official practice, that is, to use ConfigMap or Secret to hide sensitive fields.
For example, you now need to add a password to the env, which would normally be like this:
When orchestrating yaml configuration, passwords will be stored in clear text, which is very unsafe. You can use Kubernetes Secret to implement hiding as follows:
Create a Secret:
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: username123
password: password123
Execute:
Using Secret in env:
containers:
- name: mycontainer
image: redis
env:
- name: SECRET_PASSWORD
valueFrom:
secretKeyRef:
name: mysecret
key: password
optional: false
See doc.