Deploy OneAgent Operator on OpenShift (deprecated)
This procedure is deprecated.
- If you are making a fresh installation, you should set up OpenShift monitoring using Dynatrace Operator.
- If you already have OneAgent installed using OneAgent Operator, please see the instructions for migrating to Dynatrace Operator.
The instructions below apply to OpenShift Dedicated as well. For OpenShift Dedicated, you need cluster-admin privileges.
Installation
Find out below how to install and configure OneAgent.
- Generate an API token and a PaaS token in your Dynatrace environment.
Make sure you have the Access problem and event feed, metrics, and topology setting enabled for the API token.
Pods must allow egress to your Dynatrace environment or to your Environment ActiveGate in order for metric routing to work properly.
- See Support lifecycle for supported OpenShift versions.
-
Add a new project.
1oc adm new-project --node-selector="" dynatrace -
OCP version 3.11 Provide image pull secrets.
Skip this step if you're using a later version.
In order to use the certified OneAgent Operator and OneAgent images from Red Hat Container Catalog (RHCC), you need to provide image pull secrets. The Service Accounts on theopenshift.yaml
manifest already have links to the secrets to be created below.1# For OCP 3.112oc -n dynatrace create secret docker-registry redhat-connect --docker-server=registry.connect.redhat.com --docker-username=REDHAT_CONNECT_USERNAME --docker-password=REDHAT_CONNECT_PASSWORD --docker-email=unused3oc -n dynatrace create secret docker-registry redhat-connect-sso --docker-server=sso.redhat.com --docker-username=REDHAT_CONNECT_USERNAME --docker-password=REDHAT_CONNECT_PASSWORD --docker-email=unused -
OCP version 4.x OCP version 3.11 Apply the
openshift.yaml
manifest to deploy the OneAgent Operator.1oc apply -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/openshift.yaml2oc -n dynatrace logs -f deployment/dynatrace-oneagent-operatorFor OpenShift versions earlier than 3.11.188 you need to delete the
type: object
line beneath the required spec validation inopenshift.yaml
before deploying theCustomResourceDefinition
(OpenShift known bug).1required:2- spec3type: object # delete this line, which is a validation rule -
Create the secret that holds the API and PaaS tokens for authenticating to the Dynatrace Cluster.
The name of the secret will be important in a later step when you configure the custom resource (.spec.tokens
). In the following code-snippet the name isoneagent
. Be sure to replaceAPI_TOKEN
andPAAS_TOKEN
with the values mentioned in prerequisites.1oc -n dynatrace create secret generic oneagent --from-literal="apiToken=API_TOKEN" --from-literal="paasToken=PAAS_TOKEN" -
Save the custom resource.
The rollout of Dynatrace OneAgent is governed by a custom resource of typeOneAgent
. Retrieve thecr.yaml
file from the GitHub repository.1curl -o cr.yaml https://raw.githubusercontent.com/Dynatrace/dynatrace-oneagent-operator/master/deploy/cr.yaml -
Adapt the custom resource.
If you want to revert an argument, you need to set it to empty instead of removing it from the custom resource. Example:
1args:2 - "--set-proxy="Parameter Description Default value apiUrl
required
For Dynatrace SaaS, where OneAgent can connect to the internet, replace the DynatraceENVIRONMENTID
inhttps://ENVIRONMENTID.live.dynatrace.com/api
.
For Environment ActiveGates (SaaS or Managed), use the following to download the OneAgent, as well as to communicate OneAgent traffic through the ActiveGate:https://YourActiveGateIP
orFQDN:9999/e/<ENVIRONMENTID>/api
.useUnprivilegedMode
optional Set to false
if you want to mark the pod as privileged. Defaults to using Linux capabilities for the OneAgent podtrue
tokens
optional Name of the secret that holds the API and PaaS tokens from above. Name of custom resource ( .metadata.name
) if unsetuseImmutableImage
optional Set to true
if you want to pull a OneAgent Docker image from your Dynatrace environment. Use this parameter together with theagentVersion
parameter to control the version of OneAgent.false
agentVersion
optional Set this value to the OneAgent version using semantic versioning ( major.minor.patch
). Example:1.203.0
latest version args
optional Parameters to be passed to the OneAgent installer. All the command line parameters of the installer are supported, with the exception of INSTALL_PATH
.env
optional Environment variables for OneAgent container. skipCertCheck
optional Disable certificate validation checks for installer download and API communication. Set to true
if you want to skip any certification validation checks.false
nodeSelector
optional Keep empty default value. If you want to roll out OneAgent to specific nodes only, provide the nodeSelectors
here. Refer to Kubernetes docs for details.tolerations
optional Keep default value to also roll out the OneAgent to master nodes if possible. If you want to apply additional tolerations to OneAgent pods for tainted nodes, provide them here. Refer to Kubernetes docs for details. image
optional Define the OneAgent image to be taken. Defaults to the publicly available OneAgent image on Docker Hub. In order to use the certified OneAgent image from Red Hat Container Catalog you need to set .spec.image
toregistry.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
optional Resource requests/limits for the OneAgent pods. These settings heavily depend on size of worker nodes and workloads. Please adjust to fit your needs. priorityClassName
optional Priority class for OneAgent pod. Refer to Kubernetes docs. disableAgentUpdate
optional Disable the Operator's auto-update feature for OneAgent pods. false
enableIstio
optional Enable management of Istio service entries and virtual services for Dynatrace endpoints to allow for OneAgent monitoring egress traffic to your Dynatrace environment false
trustedCAs
optional Name of the ConfigMap containing the custom CA certificates. The ConfigMap must have a field called certs
with the content of the PEM bundle. These custom certificates will be used by both the OneAgent Operator and the OneAgent.If not set, the default embedded certificates on the images will be used. -
Create the custom resource.
1oc apply -f cr.yaml -
optional Configure proxy.
- You can configure optional parameters like proxy settings in the
cr.yaml
file in order todownload the OneAgent installer
ensure the communication between the OneAgent and your Dynatrace environment
ensure the communication between the Dynatrace OneAgent Operator and the Dynatrace API.
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
1apiVersion: dynatrace.com/v1alpha12kind: OneAgent3metadata:4 name: oneagent5 namespace: dynatrace6spec:7 apiUrl: https://environmentid.dynatrace.com/api8 tolerations:9 - effect: NoSchedule10 key: node-role.kubernetes.io/master11 operator: Exists12 args: []13 enableIstio: true14 proxy:15 value: http://mysuperproxyIf your proxy uses credentials
-
Create a secret with a field called
proxy
which holds your encrypted proxy URL with the credentials.
Example.1oc -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.1apiVersion: dynatrace.com/v1alpha12kind: OneAgent3metadata:4 name: oneagent5 namespace: dynatrace6spec:7 apiUrl: https://environmentid.dynatrace.com/api8 tolerations:9 - effect: NoSchedule10 key: node-role.kubernetes.io/master11 operator: Exists12 args: []13 enableIstio: true14 proxy:15 valueFrom: myproxysecret
- You can configure optional parameters like proxy settings in the
-
optional Configure network zones.
You can configure network zones by setting the following argument:
1args:2 - --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.
Cluster-wide permissions
The following table shows the permissions needed for OneAgent Operator.
Resources accessed | APIs used | Resource names |
---|---|---|
Nodes | Get/List/Watch | - |
Namespaces | Get/List/Watch | - |
Secrets | Create | - |
Secrets | Get/Update/Delete | dynatrace-oneagent-config , dynatrace-oneagent-pull-secret |
Limitations
See Docker limitations for details.
Troubleshoot
Find out how to troubleshoot issues that you may encounter when deploying OneAgent on OpenShift.
Deploy an ActiveGate and connect your Kubernetes API to Dynatrace
Now that you have OneAgent running on your OpenShift nodes, you're able to monitor those nodes, and the applications running in OpenShift. 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 OpenShift as a StatefulSet.
Update OneAgent Operator with oc
OneAgent Operator for OpenShift version 3.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 of the custom resource.
To update OneAgent Operator, run the following command:
1oc apply -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/openshift.yaml
Update OneAgent Operator with Helm
-
Update your Helm repositories.
1helm repo updateAlternative method: add it again. This will overwrite 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.1helm upgrade dynatrace-oneagent-operator dynatrace/\2dynatrace-oneagent-operator -n dynatrace --reuse-values
Uninstall OneAgent Operator
To uninstall OneAgent Operator from OpenShift version 3.9+
-
Remove OneAgent custom resources and clean up all remaining OneAgent Operator–specific objects.
1oc delete -n dynatrace oneagent --all2oc delete -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/openshift.yaml -
optional After you delete 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.