Skip to content

Deploy on Kubernetes


Install DataKit Agent

Before performing system and application link analysis, you need to deploy the TrueWatch DataKit collector on each target host to collect necessary link data.

Enable DDTrace Collector

DDTrace is used to receive, process, and analyze Tracing protocol data. Execute the following command to enable the DDTrace collector. For configurations of other third-party Tracing collectors, please refer to Integrations.

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

After configuration, restart DataKit:

datakit service -R

Choose Language

Java

Note

Please use the versioned TrueWatch Java tracer path below. To view the license, declarations, third-party statements, checksums, and source code/change logs for this version, please refer to TrueWatch Java Tracer Extension Statement.

Install dependencies:

wget -O dd-java-agent.jar 'https://static.truewatch.com/dd-image/dd-java-agent.jar'

Run the application:

In Kubernetes, you can inject the trace agent via Datakit Operator, or manually mount the trace agent into the application container:

apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - name: <CONTAINER_NAME>
          image: <CONTAINER_IMAGE>/<TAG>
          env: 
            - name: DD_AGENT_HOST
              value: "datakit-service.datakit.svc"
            - name: DD_TRACE_AGENT_PORT
              value: 9529

Parameter configuration:

  1. service.name: Service name.
  2. env: Environment information of the application service.
  3. version: Version number.
  4. Customize the DataKit listening address. If not set, it follows the default address.
  5. Set the sampling rate: After enabling, it can reduce the actual amount of data generated. The number range is from 0.0 (0%) to 1.0 (100%).
  6. Collect Profiling data: After enabling, you can see more information about the application runtime.
  7. Enable JVM Metrics collection: Requires simultaneous enabling of the statsd collector.

For more parameter configurations, refer to here.

Python

Install dependencies:

pip install ddtrace

Run the application:

apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - name: <CONTAINER_NAME>
          image: <CONTAINER_IMAGE>/<TAG>
          env: 
            - name: DD_AGENT_HOST
              value: "datakit-service.datakit.svc"
            - name: DD_TRACE_AGENT_PORT
              value: 9529

Parameter configuration:

  1. service.name: Service name.
  2. env: Environment information of the application service.
  3. version: Version number.
  4. Customize the DataKit listening address. If not set, it follows the default address.
  5. Set the sampling rate for the service: After enabling, it can reduce the actual amount of data generated. The number range is from 0.0 (0%) to 1.0 (100%).
  6. Collect Profiling data: After enabling, you can see more information about the application runtime.
  7. Enable Python Metrics collection: Requires simultaneous enabling of the statsd collector.

For more parameter configurations, refer to here.

Golang

Install dependencies:

go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer

Run the application:

apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - name: <CONTAINER_NAME>
          image: <CONTAINER_IMAGE>/<TAG>
          env: 
            - name: DD_AGENT_HOST
              value: "datakit-service.datakit.svc"
            - name: DD_TRACE_AGENT_PORT
              value: 9529

Parameter configuration:

  1. service.name: Service name.
  2. env: Environment information of the application service.
  3. version: Version number.
  4. Customize the DataKit listening address. If not set, it follows the default address.
  5. Set the sampling rate: After enabling, it can reduce the actual amount of data generated. The number range is from 0.0 (0%) to 1.0 (100%).

For more parameter configurations, refer to here.

Node.JS

Run the application:

apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - name: <CONTAINER_NAME>
          image: <CONTAINER_IMAGE>/<TAG>
          env: 
            - name: DD_AGENT_HOST
              value: "datakit-service.datakit.svc"
            - name: DD_TRACE_AGENT_PORT
              value: 9529

Parameter configuration:

  1. service.name: Service name.
  2. env: Environment information of the application service.
  3. version: Version number.
  4. Customize the DataKit listening address. If not set, it follows the default address.
  5. Set the sampling rate: After enabling, it can reduce the actual amount of data generated. The number range is from 0.0 (0%) to 1.0 (100%).

C++

PHP

Run the application:

apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - name: <CONTAINER_NAME>
          image: <CONTAINER_IMAGE>/<TAG>
          env: 
            - name: DD_AGENT_HOST
              value: "datakit-service.datakit.svc"
            - name: DD_TRACE_AGENT_PORT
              value: 9529

Parameter configuration:

  1. service.name: Service name.
  2. env: Environment information of the application service.
  3. version: Version number.
  4. Customize the DataKit listening address. If not set, it follows the default address.
  5. Set the sampling rate for the service: After enabling, it can reduce the actual amount of data generated. The number range is from 0.0 (0%) to 1.0 (100%).
  6. Collect Profiling data: After enabling, you can see more information about the application runtime.