-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cswatt/operator2 #8494
Cswatt/operator2 #8494
Changes from 26 commits
006789e
f64a5d1
a41720e
3536a09
c1f0ad7
37c2e82
d566a4b
3261a65
534cc21
c637096
5faa967
401bead
f7854f1
7dbd06d
a5ae44f
4fec437
1a82e33
de464dc
5869de3
ab7a359
a013073
911ff7a
fa5f688
3a5ead7
395f441
e9e29c6
332dd9a
44ed9a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
--- | ||
title: Advanced setup for Datadog Operator | ||
kind: faq | ||
further_reading: | ||
- link: 'agent/kubernetes/log' | ||
tag: 'Documentation' | ||
text: 'Datadog and Kubernetes' | ||
--- | ||
|
||
[The Datadog Operator][1] is in public beta. The Datadog Operator is a way to deploy the Datadog Agent on Kubernetes and OpenShift. It reports deployment status, health, and errors in its Custom Resource status, and it limits the risk of misconfiguration thanks to higher-level configuration options. | ||
|
||
## Prerequisites | ||
|
||
Using the Datadog Operator requires the following prerequisites: | ||
|
||
- **Kubernetes Cluster version >= v1.14.X**: Tests were done on versions >= `1.14.0`. Still, it should work on versions `>= v1.11.0`. For earlier versions, because of limited CRD support, the Operator may not work as expected. | ||
- [`Helm`][2] for deploying the `datadog-operator`. | ||
- [`Kubectl` CLI][3] for installing the `datadog-agent`. | ||
|
||
## Deploy the Datadog Operator | ||
|
||
To use the Datadog Operator, deploy it in your Kubernetes cluster. Then create a `DatadogAgent` Kubernetes resource that contains the Datadog deployment configuration: | ||
|
||
1. Add the Datadog Helm repo: | ||
``` | ||
helm repo add datadog https://helm.datadoghq.com | ||
``` | ||
|
||
2. Install the Datadog Operator: | ||
``` | ||
helm install datadog/datadog-operator | ||
``` | ||
|
||
## Deploy the Datadog Agents with the Operator | ||
|
||
After deploying the Datadog Operator, create the `DatadogAgent` resource that triggers the Datadog Agent's deployment in your Kubernetes cluster. By creating this resource in the `Datadog-Operator` namespace, the Agent is deployed as a `DaemonSet` on every `Node` of your cluster. | ||
|
||
Create the `datadog-agent.yaml` manifest out of one of the following templates: | ||
|
||
* [Manifest with Logs, APM, process, and metrics collection enabled.][4] | ||
* [Manifest with Logs, APM, and metrics collection enabled.][5] | ||
* [Manifest with Logs and metrics collection enabled.][6] | ||
* [Manifest with APM and metrics collection enabled.][7] | ||
* [Manifest with Cluster Agent.][8] | ||
* [Manifest with tolerations.][9] | ||
|
||
Replace `<DATADOG_API_KEY>` and `<DATADOG_APP_KEY>` with your [Datadog API and application keys][10], then trigger the Agent installation with the following command: | ||
|
||
```shell | ||
$ kubectl apply -n $DD_NAMESPACE -f datadog-agent.yaml | ||
datadogagent.datadoghq.com/datadog created | ||
``` | ||
|
||
You can check the state of the `DatadogAgent` ressource with: | ||
|
||
```shell | ||
kubectl get -n $DD_NAMESPACE dd datadog | ||
NAME ACTIVE AGENT CLUSTER-AGENT CLUSTER-CHECKS-RUNNER AGE | ||
datadog-agent True Running (2/2/2) 110m | ||
``` | ||
|
||
In a 2-worker-nodes cluster, you should see the Agent pods created on each node. | ||
|
||
```shell | ||
$ kubectl get -n $DD_NAMESPACE daemonset | ||
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE | ||
datadog-agent 2 2 2 2 2 <none> 5m30s | ||
|
||
$ kubectl get -n $DD_NAMESPACE pod -owide | ||
NAME READY STATUS RESTARTS AGE IP NODE | ||
agent-datadog-operator-d897fc9b-7wbsf 1/1 Running 0 1h 10.244.2.11 kind-worker | ||
datadog-agent-k26tp 1/1 Running 0 5m59s 10.244.2.13 kind-worker | ||
datadog-agent-zcxx7 1/1 Running 0 5m59s 10.244.1.7 kind-worker2 | ||
``` | ||
|
||
|
||
## Cleanup | ||
|
||
The following command deletes all the Kubernetes resources created by the above instructions: | ||
|
||
```shell | ||
kubectl delete datadogagent datadog | ||
helm delete datadog | ||
``` | ||
|
||
### Tolerations | ||
|
||
Update your `datadog-agent.yaml` file with the following configuration to add the toleration in the `Daemonset.spec.template` of your `DaemonSet` : | ||
|
||
```yaml | ||
apiVersion: datadoghq.com/v1alpha1 | ||
kind: DatadogAgent | ||
metadata: | ||
name: datadog | ||
spec: | ||
credentials: | ||
apiKey: "<DATADOG_API_KEY>" | ||
appKey: "<DATADOG_APP_KEY>" | ||
agent: | ||
image: | ||
name: "datadog/agent:latest" | ||
config: | ||
tolerations: | ||
- operator: Exists | ||
``` | ||
|
||
Apply this new configuration: | ||
|
||
```shell | ||
$ kubectl apply -f datadog-agent.yaml | ||
datadogagent.datadoghq.com/datadog updated | ||
``` | ||
|
||
The DaemonSet update can be validated by looking at the new desired pod value: | ||
|
||
```shell | ||
$ kubectl get -n $DD_NAMESPACE daemonset | ||
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE | ||
datadog-agent 3 3 3 3 3 <none> 7m31s | ||
|
||
$ kubectl get -n $DD_NAMESPACE pod | ||
NAME READY STATUS RESTARTS AGE | ||
agent-datadog-operator-d897fc9b-7wbsf 1/1 Running 0 15h | ||
datadog-agent-5ctrq 1/1 Running 0 7m43s | ||
datadog-agent-lkfqt 0/1 Running 0 15s | ||
datadog-agent-zvdbw 1/1 Running 0 8m1s | ||
``` | ||
|
||
## Further Reading | ||
|
||
{{< partial name="whats-next/whats-next.html" >}} | ||
|
||
[1]: https://github.com/DataDog/datadog-operator | ||
[2]: https://helm.sh | ||
[3]: https://kubernetes.io/docs/tasks/tools/install-kubectl/ | ||
[4]: https://github.com/DataDog/datadog-operator/blob/master/examples/datadog-agent-all.yaml | ||
[5]: https://github.com/DataDog/datadog-operator/blob/master/examples/datadog-agent-logs-apm.yaml | ||
[6]: https://github.com/DataDog/datadog-operator/blob/master/examples/datadog-agent-logs.yaml | ||
[7]: https://github.com/DataDog/datadog-operator/blob/master/examples/datadog-agent-apm.yaml | ||
[8]: https://github.com/DataDog/datadog-operator/blob/master/examples/datadog-agent-with-clusteragent.yaml | ||
[9]: https://github.com/DataDog/datadog-operator/blob/master/examples/datadog-agent-with-tolerations.yaml | ||
[10]: https://app.datadoghq.com/account/settings#api |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,11 +174,64 @@ To install the Datadog Agent on your Kubernetes cluster: | |
{{% /tab %}} | ||
{{% tab "Operator" %}} | ||
|
||
[The Datadog Operator][1] is in public beta. The Datadog Operator is a way to deploy the Datadog Agent on Kubernetes and OpenShift. It reports deployment status, health, and errors in its Custom Resource status, and it limits the risk of misconfiguration thanks to higher-level configuration options. To get started, check out the [Getting Started page][2] in the [Datadog Operator repo][1] or install the operator from the [OperatorHub.io Datadog Operator page][3]. | ||
[The Datadog Operator][1] is in public beta. The Datadog Operator is a way to deploy the Datadog Agent on Kubernetes and OpenShift. It reports deployment status, health, and errors in its Custom Resource status, and it limits the risk of misconfiguration thanks to higher-level configuration options. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same beta call out feedback |
||
|
||
[1]: https://github.com/DataDog/datadog-operator/blob/master/docs/getting_started.md | ||
[2]: https://github.com/DataDog/datadog-operator | ||
[3]: https://operatorhub.io/operator/datadog-operator | ||
## Prerequisites | ||
|
||
Using the Datadog Operator requires the following prerequisites: | ||
|
||
- **Kubernetes Cluster version >= v1.14.X**: Tests were done on versions >= `1.14.0`. Still, it should work on versions `>= v1.11.0`. For earlier versions, because of limited CRD support, the Operator may not work as expected. | ||
- [`Helm`][2] for deploying the `datadog-operator`. | ||
- [`Kubectl` CLI][3] for installing the `datadog-agent`. | ||
|
||
|
||
## Deploy an Agent with the Operator | ||
|
||
To deploy a Datadog Agent with the Operator in the minimum number of steps, use the [`datadog-agent-with-operator`][4] Helm chart. | ||
Here are the steps: | ||
|
||
1. [Download the chart][5]: | ||
|
||
```shell | ||
curl -Lo datadog-agent-with-operator.tar.gz https://github.com/DataDog/datadog-operator/releases/latest/download/datadog-agent-with-operator.tar.gz | ||
``` | ||
|
||
2. Create a file with the spec of your Agent. The simplest configuration is: | ||
|
||
```yaml | ||
credentials: | ||
apiKey: <DATADOG_API_KEY> | ||
appKey: <DATADOG_APP_KEY> | ||
agent: | ||
image: | ||
name: "datadog/agent:latest" | ||
``` | ||
|
||
Replace `<DATADOG_API_KEY>` and `<DATADOG_APP_KEY>` with your [Datadog API and application keys][6] | ||
|
||
3. Deploy the Datadog Agent with the above configuration file: | ||
```shell | ||
helm install --set-file agent_spec=/path/to/your/datadog-agent.yaml datadog datadog-agent-with-operator.tar.gz | ||
``` | ||
|
||
## Cleanup | ||
|
||
The following command deletes all the Kubernetes resources created by the above instructions: | ||
|
||
```shell | ||
kubectl delete datadogagent datadog | ||
helm delete datadog | ||
``` | ||
|
||
For further details on setting up Operator, including information about using tolerations, refer to the [Datadog Operator advanced setup guide][7]. | ||
|
||
[1]: https://github.com/DataDog/datadog-operator | ||
[2]: https://helm.sh | ||
[3]: https://kubernetes.io/docs/tasks/tools/install-kubectl/ | ||
[4]: https://github.com/DataDog/datadog-operator/tree/master/chart/datadog-agent-with-operator | ||
[5]: https://github.com/DataDog/datadog-operator/releases/latest/download/datadog-agent-with-operator.tar.gz | ||
[6]: https://app.datadoghq.com/account/settings#api | ||
[7]: /agent/guide/operator-advanced | ||
{{% /tab %}} | ||
{{< /tabs >}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add the missing Operator tab in the Events Collection section below? |
||
|
||
|
@@ -203,9 +256,22 @@ Set the `datadog.leaderElection`, `datadog.collectEvents` and `agents.rbac.creat | |
{{% /tab %}} | ||
{{% tab "DaemonSet" %}} | ||
|
||
If you want to collect events from your kubernetes cluster set the environment variables `DD_COLLECT_KUBERNETES_EVENTS` and `DD_LEADER_ELECTION` to `true` in your Agent manifest. Alternatively, use the [Datadoc Cluster Agent Event collection][1] | ||
If you want to collect events from your Kubernetes cluster set the environment variables `DD_COLLECT_KUBERNETES_EVENTS` and `DD_LEADER_ELECTION` to `true` in your Agent manifest. Alternatively, use the [Datadoc Cluster Agent Event collection][1] | ||
|
||
[1]: /agent/cluster_agent/event_collection/ | ||
{{% /tab %}} | ||
{{% tab "Operator" %}} | ||
|
||
Set `agent.config.collectEvents` to `true` in your `datadog-agent.yaml` manifest. | ||
|
||
For example: | ||
|
||
``` | ||
agent: | ||
config: | ||
collectEvents: true | ||
``` | ||
|
||
{{% /tab %}} | ||
{{< /tabs >}} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,28 @@ To enable APM trace collection, open the DaemonSet configuration file and edit t | |
# (...) | ||
``` | ||
|
||
{{% /tab %}} | ||
{{% tab "Operator" %}} | ||
|
||
Update your `datadog-agent.yaml` manifest with: | ||
|
||
``` | ||
agent: | ||
image: | ||
name: "datadog/agent:latest" | ||
apm: | ||
enabled: true | ||
``` | ||
|
||
See the sample [manifest with APM and metrics collection enabled][1] for a complete example. | ||
|
||
Then apply the new configuration: | ||
|
||
```shell | ||
$ kubectl apply -n $DD_NAMESPACE -f datadog-agent.yaml | ||
``` | ||
|
||
[1]: https://github.com/DataDog/datadog-operator/blob/master/examples/datadog-agent-apm.yaml | ||
{{% /tab %}} | ||
{{< /tabs >}} | ||
**Note**: On minikube, you may receive an `Unable to detect the kubelet URL automatically` error. In this case, set `DD_KUBELET_TLS_VERIFY=false`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Down below in the APM page, there's a table called "Agent Environment Variables" which should be replaced by the corresponding options that the DatadogAgent CRD provides. The reason is that env vars cannot be provided to the Agent directly, since it is created later by the Operator (in run-time) |
||
|
@@ -134,14 +156,28 @@ List of all environment variables available for tracing within the Agent running | |
| `DD_APM_MAX_EPS` | Sets the maximum Analyzed Spans per second. Default is 200 events per second. | | ||
| `DD_APM_MAX_TPS` | Sets the maximum traces per second. Default is 10 traces per second. | | ||
|
||
### Operator environment variables | ||
| Environment variable | Description | | ||
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `agent.apm.enabled` | Enable this to enable APM and tracing, on port 8126. See the [Datadog Docker documentation][8]. | | ||
| `agent.apm.env` | The Datadog Agent supports many [environment variables][9]. | | ||
| `agent.apm.hostPort` | Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If `HostNetwork` is specified, this must match `ContainerPort`. Most containers do not need this. | | ||
| `agent.apm.resources.limits` | Limits describes the maximum amount of compute resources allowed. For more info, see the [Kubernetes documentation][10]. | | ||
| `agent.apm.resources.requests` | Requests describes the minimum amount of compute resources required. If `requests` is omitted for a container, it defaults to `limits` if that is explicitly specified, otherwise to an implementation-defined value. For more info, see the [Kubernetes documentation][10]. | | | ||
|
||
|
||
## Further Reading | ||
|
||
{{< partial name="whats-next/whats-next.html" >}} | ||
|
||
|
||
[1]: /agent/kubernetes/ | ||
[2]: /agent/cluster_agent/admission_controller/ | ||
[3]: /tracing/setup/ | ||
[4]: /getting_started/tagging/unified_service_tagging | ||
[5]: /tracing/guide/security/#replace-rules | ||
[6]: /tracing/app_analytics/#automatic-configuration | ||
[7]: /tracing/guide/setting_primary_tags_to_scope/#environment | ||
[8]: https://github.com/DataDog/docker-dd-agent#tracing-from-the-host | ||
[9]: https://docs.datadoghq.com/agent/docker/?tab=standard#environment-variables | ||
[10]: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add in the traditional beta disclaimer