- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
For enhanced security, the Datadog Operator can retrieve Datadog credentials (API key and application key) using Secrets.
Choose one of the following methods to set up Secrets:
This method is recommended for testing purposes only.
Add your API and application keys to the DatadogAgent
spec:
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
credentials:
apiKey: <DATADOG_API_KEY>
appKey: <DATADOG_APP_KEY>
# ...
The credentials provided here are stored in a Secret created by the Operator. By properly setting the RBAC on the DatadogAgent
CRD, you can limit who is able to see those credentials.
Create your Secrets:
apiVersion: v1
kind: Secret
metadata:
name: datadog-api-secret
data:
api_key: <DATADOG_API_KEY>
---
apiVersion: v1
kind: Secret
metadata:
name: datadog-app-secret
data:
app_key: <DATADOG_APP_KEY>
Provide the names of these Secrets in your DatadogAgent
resource:
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
credentials:
apiSecret:
secretName: datadog-api-secret
keyName: api-key
appSecret:
secretName: datadog-app-secret
keyName: app-key
# ...
Note: You can also use the same Secret to store both credentials:
---
apiVersion: v1
kind: Secret
metadata:
name: datadog-secret
data:
api_key: <DATADOG_API_KEY>
app_key: <DATADOG_APP_KEY>
Then, in your DatadogAgent
resource:
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
credentials:
apiSecret:
secretName: datadog-secret
keyName: api-key
appSecret:
secretName: datadog-secret
keyName: app-key
# ...
The Datatog Operator is compatible with the secret backend.
Create a Datadog Operator container image that contains the secret backend command.
If you’d like to build your own, the following Dockerfile example takes the latest
image as the base image and copies the my-secret-backend.sh
script file:
FROM gcr.io/datadoghq/operator:latest
COPY ./my-secret-backend.sh /my-secret-backend.sh
RUN chmod 755 /my-secret-backend.sh
Then, run:
docker build -t datadog-operator-with-secret-backend:latest .
Install or update the Datadog Operator deployment with the .Values.secretBackend.command
parameter set to the secret backend command path (inside the container). If you are using a custom image, update the image.
$ helm [install|upgrade] dd-operator --set "secretBackend.command=/my-secret-backend.sh" --set "image.repository=datadog-operator-with-secret-backend" ./chart/datadog-operator
Note: Requires Datadog Operator v0.5.0+.
Kubernetes supports exposing Secrets as files inside a pod. Datadog provides a helper script in the Datadog Operator image to read the Secrets from files.
Mount the Secret in the Operator container. For example, you can mount it at /etc/secret-volume
.
Install or update the Datadog Operator deployment with the .Values.secretBackend.command
parameter set to /readsecret.sh
and the .Values.secretBackend.arguments
parameter set to /etc/secret-volume
:
helm [install|upgrade] dd-operator --set "secretBackend.command=/readsecret.sh" --set "secretBackend.arguments=/etc/secret-volume" ./chart/datadog-operator
Note: Requires Datadog Operator v1.11+.
If you are using a custom script, create a Datadog Agent (or Cluster Agent) image and specify credentials using ENC[<placeholder>]
, and specify the secret backend command in spec.global.secretBackend.command
:
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
credentials:
apiKey: ENC[<api-key-secret-id>]
appKey: ENC[<app-key-secret-id>]
secretBackend:
command: "/my-secret-backend.sh"
# ...
The environment variable DD_SECRET_BACKEND_COMMAND
from this configuration is automatically applied to all the deployed components: node Agent, Cluster Agent, and Cluster Checks Runners. Ensure the image you are using for all the components includes your command.
For convenience, the Datadog Agent and its sibling Cluster Agent images include a readsecret_multiple_providers.sh
helper function that can be used to read from both files as well as Kubernetes Secrets. After you create the Secret, set spec.global.secretBackend.command
to "/readsecret_multiple_providers.sh"
.
For instance, to use the secret backend for the Agent and Cluster Agent, create a Secret called “test-secret”:
kubectl create secret generic test-secret --from-literal=api_key='<api-key>' --from-literal=app_key='<app-key>'
And then set the DatadogAgent spec:
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
secretBackend:
command: "/readsecret_multiple_providers.sh"
credentials:
apiKey: ENC[k8s_secret@default/test-secret/api_key]
appKey: ENC[k8s_secret@default/test-secret/app_key]
The "/readsecret_multiple_providers.sh"
helper enables the Agent to directly read Kubernetes Secrets across both its own and other namespaces. Ensure that the associated ServiceAccount has the necessary permissions by assigning the appropriate Roles and RoleBindings. You can set these manually, or by using the following options:
global.secretBackend.enableGlobalPermissions
: Determines if a ClusterRole is created that enables the Agents to read all Kubernetes Secrets.
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
secretBackend:
command: "/readsecret_multiple_providers.sh"
enableGlobalPermissions: true
# ...
global.secretBackend.roles
: Replaces enableGlobalPermissions
, detailing the list of namespace/secrets to which the Agents should have access.
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
secretBackend:
command: "/readsecret_multiple_providers.sh"
roles:
- namespace: rabbitmq-system
secrets:
- "rabbitmqcluster-sample-default-user"
# ...
In this example, a Role is created granting read access to the Secret rabbitmqcluster-sample-default-user
in the rabbitmq-system
namespace.
Note: Each namespace in the roles
list must also be configured in the WATCH_NAMESPACE
or DD_AGENT_WATCH_NAMESPACE
environment variable on the Datadog Operator deployment.
For the Agent and Cluster Agent, there are other configuration options for the secret backend command:
global.secretBackend.args
: These arguments are supplied to the command when the Agent executes the secret backend command.global.secretBackend.timeout
: Secret backend execution timeout in seconds. The default value is 30 seconds.For versions prior to Operator 1.11, spec.global.secretBackend
is unavailable. You should follow these instructions instead.