Skip to content

Datakit Operator

Prerequisites

  1. Use Kubernetes v1.24.1 or higher, and ensure internet access is available (to download yaml files and pull corresponding images).
  2. Ensure the MutatingAdmissionWebhook and ValidatingAdmissionWebhook controllers are enabled.
  3. Ensure the admissionregistration.k8s.io/v1 API is enabled.

Install DataKit Agent

DataKit is used to receive trace data collected from your systems and applications. Please ensure you have installed the DataKit Agent in your Kubernetes environment.

During the installation process, you can simultaneously enable the DDTrace collector.

Enable the DDTrace Collector

Modify the datakit.yaml file. In the configuration for default enabled collectors, append ddtrace.

 - name: ENV_DEFAULT_ENABLED_INPUTS
   value: cpu,disk,diskio,mem,swap,system,hostobject,net,host_processes,container,ddtrace

Restart the application:

kubectl apply -f datakit.yaml

Install DataKit Operator

Datakit Operator can automate the deployment of applications and services, automatically inject the DDTrace SDK, and instrument them upon startup.

  1. Download the latest datakit-operator.yaml file
$ kubectl create namespace datakit
$ wget https://static.guance.com/datakit-operator/datakit-operator.yaml

2. Update the configuration file

{
    "server_listen": "0.0.0.0:9543",
    "log_level":     "info",
    "admission_inject": {
        "ddtrace": { 
           "enabled_namespaces":     [],
           "enabled_labelselectors": [],
           "images": {
                "java_agent_image":   "pubrepo.guance.com/datakit-operator/dd-lib-java-init:latest"
            },
            "envs": {
              "DD_JMXFETCH_STATSD_HOST": "datakit-service.datakit.svc",
              "DD_JMXFETCH_STATSD_PORT": "8125",
              "POD_NAME": "{fieldRef:metadata.name}",
              "POD_NAMESPACE": "{fieldRef:metadata.namespace}",
              "NODE_NAME": "{fieldRef:spec.nodeName}",
              "DD_SERVICE": "{fieldRef:metadata.labels['service']}",
              "DD_AGENT_HOST": "datakit-service.datakit.svc",
              "DD_TRACE_AGENT_PORT": "9529",
              "DD_TAGS": "pod_name:$(POD_NAME),pod_namespace:$(POD_NAMESPACE),host:$(NODE_NAME)"
            }
        },
        "logfwd": {
            "options": {
                "reuse_exist_volume": "false"
            },
            "images": {
                "logfwd_image": "pubrepo.guance.com/datakit/logfwd:1.28.1"
            }
        }
    }
}

On the page, you can directly modify parameters:

  • Service
  • Env
  • Choose whether to enable:

    • Custom DataKit listening address
    • Collect Profiling data: Enabling this allows you to see more information about application runtime.
    • Configure namespaces
    • Configure selectors

3. Execute the installation command

kubectl apply -f datakit-operator.yaml

Restart the Application

After installation is complete, restart the application Pod.