This procedure is deprecated.
Find out below how to install and configure OneAgent.
Make sure you have the Access problem and event feed, metrics, and topology setting enabled for the API token.
Create the necessary objects for OneAgent Operator.
OneAgent Operator acts on its separate namespace dynatrace
. It holds the operator deployment and all dependent objects like permissions, custom resources and the corresponding DaemonSet. You can also observe the logs of OneAgent Operator.
kubectl create namespace dynatrace
kubectl apply -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/kubernetes.yaml
kubectl -n dynatrace logs -f deployment/dynatrace-oneagent-operator
Create the secret holding API and PaaS tokens for authentication to the Dynatrace Cluster.
The name of the secret is important in a later step when you configure the custom resource (.spec.tokens
). In the following code-snippet the name is oneagent
. Be sure to replace API_TOKEN
and PAAS_TOKEN
with the values explained in the prerequisites.
kubectl -n dynatrace create secret generic oneagent --from-literal="apiToken=API_TOKEN" --from-literal="paasToken=PAAS_TOKEN"
Save custom resource.
The rollout of Dynatrace OneAgent is governed by a custom resource of type OneAgent
. Retrieve the cr.yaml
file from the GitHub repository.
curl -o cr.yaml https://raw.githubusercontent.com/Dynatrace/dynatrace-oneagent-operator/master/deploy/cr.yaml
Adapt the values of the custom resource as indicated below.
If you want to revert an argument, you need to set it to empty instead of removing it from the custom resource.
Example:
args:- "--set-proxy="
apiUrl
ENVIRONMENTID
in https://ENVIRONMENTID.live.dynatrace.com/api
.https://YourActiveGateIP
or FQDN:9999/e/<ENVIRONMENTID>/api
.useUnprivilegedMode
false
if you want to mark the pod as privileged. Defaults to using Linux capabilities for the OneAgent podtrue
tokens
.metadata.name
) if unsetuseImmutableImage
true
if you want to pull a OneAgent Docker image from your Dynatrace environment. Use this parameter together with the agentVersion
parameter to control the version of OneAgent.false
agentVersion
major.minor.patch
). Example: 1.203.0
args
INSTALL_PATH
.env
skipCertCheck
true
if you want to skip any certification validation checks.false
nodeSelector
nodeSelectors
here. Refer to Kubernetes docs for details.tolerations
image
.spec.image
to registry.connect.redhat.com/dynatrace/oneagent
in the custom resource and provide image pull secrets as shown in the next step.docker.io/dynatrace/oneagent:latest
if unsetresources
disableAgentUpdate
false
enableIstio
false
trustedCAs
certs
.For Anthos, SUSE CaaS, Google Kubernetes Engine, and VMware Tanzu Kubernetes Grid Integrated Edition (formerly PKE), you must add the following additional parameters to the env
section in the cr.yaml
file:
env:- name: ONEAGENT_ENABLE_VOLUME_STORAGEvalue: "true"
env:- name: ONEAGENT_ENABLE_VOLUME_STORAGEvalue: "true"- name: ONEAGENT_CONTAINER_STORAGE_PATHvalue: /var/vcap/store
env:- name: ONEAGENT_ENABLE_VOLUME_STORAGEvalue: "true"- name: ONEAGENT_CONTAINER_STORAGE_PATHvalue: /opt
env:- name: ONEAGENT_ENABLE_VOLUME_STORAGEvalue: "true"
Create the custom resource.
kubectl apply -f cr.yaml
optional Configure proxy.
cr.yaml
file in order to
There are two ways to provide the proxy, depending on whether or not your proxy uses credentials.
If you have a proxy that doesn't use credentials, enter your proxy URL directly in the value
field for the proxy.
Example
apiVersion: dynatrace.com/v1alpha1kind: OneAgentmetadata:name: oneagentnamespace: dynatracespec:apiUrl: https://environmentid.dynatrace.com/apitolerations:- effect: NoSchedulekey: node-role.kubernetes.io/masteroperator: Existsargs: []enableIstio: trueproxy:value: http://mysuperproxy
If your proxy uses credentials
Create a secret with a field called proxy
which holds your encrypted proxy URL with the credentials.
Example.
kubectl -n dynatrace create secret generic myproxysecret --from-literal="proxy=http://<user>:<password>@<IP>:<PORT>"
Provide the name of the secret in the valueFrom
section.
Example.
apiVersion: dynatrace.com/v1alpha1kind: OneAgentmetadata:name: oneagentnamespace: dynatracespec:apiUrl: https://environmentid.dynatrace.com/apitolerations:- effect: NoSchedulekey: node-role.kubernetes.io/masteroperator: Existsargs: []enableIstio: trueproxy:valueFrom: myproxysecret
optional Configure network zones.
You can configure network zones by setting the following argument:
args:- --set-network-zone=<your.network.zone>
See network zones for more information.
After deployment, you need to restart your pods so OneAgent can inject into them.
The following table shows the permissions needed for OneAgent Operator.
Nodes
Namespaces
Secrets
Secrets
dynatrace-oneagent-config
, dynatrace-oneagent-pull-secret
See Docker limitations for details.
Find out how to troubleshoot issues that you may encounter when deploying OneAgent on Kubernetes.
Now that you have OneAgent running on your Kubernetes nodes, you're able to monitor those nodes, and the applications running in Kubernetes. The next step is to deploy an ActiveGate and connect your Kubernetes API to Dynatrace in order to get native Kubernetes metrics, like request limits, and differences in pods requested vs. running pods.
For further instructions see Deploy ActiveGate in Kubernetes as a StatefulSet.
OneAgent Operator (for Kubernetes version 1.9+) automatically takes care of the lifecycle of the deployed OneAgents, so you don't need to update OneAgent pods yourself.
Review the release notes of the Operator for any breaking changes on the custom resource.
If the custom resource of the new version is compatible with the already deployed version, you can simply set the OneAgent Operator image to the new tagged version. Be sure to replace vX.Y.Z
with the new version in the following command:
kubectl -n dynatrace set image deployment \dynatrace-oneagent-operator *=quay.io/dynatrace/\dynatrace-oneagent-operator:vX.Y.Z
The image version of the OneAgent Operator is independent from the OneAgent version. To check the available versions for the Operator, see the OneAgent Operator releases.
To update OneAgent Operator, run the following command:
kubectl apply -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/kubernetes.yaml
Update your Helm repositories.
helm repo update
Another method of updating the Dynatrace OneAgent Helm repository is adding it again, which overwrites the older version.
Update OneAgent to the latest version.
Don't omit the --reuse-values
flag in the command in order to keep your configuration.
helm upgrade dynatrace-oneagent-operator dynatrace/\dynatrace-oneagent-operator -n dynatrace --reuse-values
To uninstall OneAgent Operator from Kubernetes version 1.9+
Remove OneAgent custom resources and clean up all remaining OneAgent Operator–specific objects.
kubectl delete -n dynatrace oneagent --allkubectl delete -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/kubernetes.yaml
optional After deleting OneAgent Operator, the OneAgent binary remains on the node in an inactive state. To uninstall it completely, run the uninstall.sh
script and delete logs and configuration files.
See Linux related information.