This repository contains the source code for the Datadog CSI Driver.
This driver allows mounting CSI volumes instead of hostPath volumes in pods that need access for UDS sockets for DogStatsD and APM. This allows pods in namespaces with baseline or restrictive pod security standards to get access to the UDS sockets on which the datadog agent listens for custom metrics and APM traces.
- Mounting Datadog dogstatsd socket: Supported using the
DSDSocketorDSDSocketDirectoryvolume type. - Mounting Datadog trace agent socket: Supported using
APMSocketorAPMSocketDirectoryvolume type.
- Kubernetes 1.13 or later.
- Golang setup for development.
- Docker setup for building the driver.
CSI volumes processed by this driver must have the following format:
csi:
driver: k8s.csi.datadoghq.com
volumeAttributes:
type: <volume-type>
name: <volume-name>
For example:
apiVersion: v1
kind: Pod
metadata:
name: pod-name
spec:
containers:
- name: ubuntu
image: ubuntu
command: ["/bin/bash", "-c", "--"]
args: ["while true; do sleep 30; echo hello-ubuntu; done;"]
volumeMounts:
- mountPath: /var/sockets/apm/
name: dd-csi-volume-apm-dir
- mountPath: /var/sockets/dsd/dsd.sock
name: dd-csi-volume-dsd
volumes:
- name: dd-csi-volume-dsd
csi:
driver: k8s.csi.datadoghq.com
volumeAttributes:
type: DSDSocket
- name: dd-csi-volume-apm-dir
csi:
driver: k8s.csi.datadoghq.com
volumeAttributes:
type: APMSocketDirectoryCurrently, 4 types are supported:
- APMSocket
- APMSocketDirectory
- DSDSocket
- DSDSocketDirectory
This type is useful for mounting a trace agent UDS socket file.
For example:
csi:
driver: k8s.csi.datadoghq.com
volumeAttributes:
type: APMSocket
name: datadog-apm
In case the indicated socket doesn't exist, the mount operation will fail, and the pod will be blocked in ContainerCreating phase.
This mode is useful for mounting the directory containing the apm socket.
For example:
csi:
driver: k8s.csi.datadoghq.com
readOnly: false
volumeAttributes:
type: APMSocketDirectory
name: datadogThis type is useful for mounting a dogstatsd UDS socket file.
For example:
csi:
driver: k8s.csi.datadoghq.com
volumeAttributes:
type: DSDSocket
name: datadog-dsd
In case the indicated socket doesn't exist, the mount operation will fail, and the pod will be blocked in ContainerCreating phase.
This mode is useful for mounting the directory containing the dogstatsd socket.
For example:
csi:
driver: k8s.csi.datadoghq.com
readOnly: false
volumeAttributes:
type: DSDSocketDirectory
name: datadog
Distributed under the Apache License. See LICENSE for more information.