Deployment on Kubernetes¶
Install DataKit Agent¶
Before performing link data analysis for systems and applications, it is necessary to deploy Guance DataKit collector on each target host to collect the required tracing data.
Enable DDTrace Collector¶
DDTrace is used to receive, process, and analyze Tracing protocol data. Run the following command to enable the DDTrace collector. For other third-party tracing collector configurations, refer to Integration.
- name: ENV_DEFAULT_ENABLED_INPUTS
value: cpu,disk,diskio,mem,swap,system,hostobject,net,host_processes,container,ddtrace
After configuration, restart DataKit:
Select Language¶
Java¶
Install dependencies:
Run application:
In Kubernetes, you can inject the trace agent via the 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:
Parameter configuration:
service.name
: Service name;env
: Environment information of the application service;version
: Version number;- Custom DataKit listening address; if not set, it follows the default address;
- Set sampling rate: After enabling, it can reduce the actual amount of data generated; the range is from 0.0(0%) ~ 1.0(100%);
- Collect Profiling data: After enabling, more runtime information of the application can be seen;
- Enable JVM metrics collection: Requires simultaneous activation of the statsd collector.
For more parameter configurations, refer to here.
Python¶
Install dependencies:
Run application:
You can run your Python code through various methods such as IDE, virtual environments, or directly using the python
command. Below is an example using the python
command:
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- name: <CONTAINER_NAME>
image: <CONTAINER_IMAGE>/<TAG>
env:
Parameter configuration:
service.name
: Service name;env
: Environment information of the application service;version
: Version number;- Custom DataKit listening address; if not set, it follows the default address;
- Set sampling rate: After enabling, it can reduce the actual amount of data generated; the range is from 0.0(0%) ~ 1.0(100%);
- Collect Profiling data: After enabling, more runtime information of the application can be seen;
- Enable Python metrics collection: Requires simultaneous activation of the statsd collector.
For more parameter configurations, refer to here.
Golang¶
Install dependencies:
Run application:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
tags.datadoghq.com/env: <env>
tags.datadoghq.com/service: <service>
tags.datadoghq.com/version: <version>
spec:
template:
metadata:
labels:
tags.datadoghq.com/env: <env>
tags.datadoghq.com/service: <service>
tags.datadoghq.com/version: <version>
spec:
volumes:
- hostPath:
path: /var/run/datadog/
name: apmsocketpath
containers:
- name: <CONTAINER_NAME>
image: <CONTAINER_IMAGE>/<TAG>
volumeMounts:
- name: apmsocketpath
mountPath: /var/run/datadog
env:
- name: DD_ENV
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/env']
- name: DD_SERVICE
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/service']
- name: DD_VERSION
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/version']
Parameter configuration:
service.name
: Service name;env
: Environment information of the application service;version
: Version number;- Custom DataKit listening address; if not set, it follows the default address;
- Set sampling rate: After enabling, it can reduce the actual amount of data generated; the range is from 0.0(0%) ~ 1.0(100%).
For more parameter configurations, refer to here.
Node.JS¶
Run application:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
tags.datadoghq.com/env: <env>
tags.datadoghq.com/service: <service>
tags.datadoghq.com/version: <version>
spec:
template:
metadata:
labels:
tags.datadoghq.com/env: <env>
tags.datadoghq.com/service: <service>
tags.datadoghq.com/version: <version>
spec:
containers:
- name: <CONTAINER_NAME>
image: <CONTAINER_IMAGE>/<TAG>
env:
- name: DD_AGENT_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: DD_ENV
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/env']
- name: DD_SERVICE
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/service']
- name: DD_VERSION
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/version']
Parameter configuration:
service.name
: Service name;env
: Environment information of the application service;version
: Version number;- Custom DataKit listening address; if not set, it follows the default address;
- Set sampling rate: After enabling, it can reduce the actual amount of data generated; the range is from 0.0(0%) ~ 1.0(100%).
C++¶
PHP¶
Run application:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
tags.datadoghq.com/env: <env>
tags.datadoghq.com/service: <service>
tags.datadoghq.com/version: <version>
spec:
template:
metadata:
labels:
tags.datadoghq.com/env: <env>
tags.datadoghq.com/service: <service>
tags.datadoghq.com/version: <version>
spec:
volumes:
- hostPath:
path: /var/run/datadog/
name: apmsocketpath
containers:
- name: <CONTAINER_NAME>
image: <CONTAINER_IMAGE>/<TAG>
volumeMounts:
- name: apmsocketpath
mountPath: /var/run/datadog
env:
- name: DD_ENV
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/env']
- name: DD_SERVICE
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/service']
- name: DD_VERSION
valueFrom:
fieldRef:
fieldPath:
metadata.labels['tags.datadoghq.com/version']
Parameter configuration:
service.name
: Service name;env
: Environment information of the application service;version
: Version number;- Custom DataKit listening address; if not set, it follows the default address;
- Set sampling rate: After enabling, it can reduce the actual amount of data generated; the range is from 0.0(0%) ~ 1.0(100%);
- Collect Profiling data: After enabling, more runtime information of the application can be seen.