This procedure describes how to set up OpenShift monitoring using Dynatrace Operator versions 0.2.0 and earlier.
If you are making a fresh installation, we recommend that you set up OpenShift monitoring using Dynatrace Operator version 0.30+.
If you already set up monitoring with Dynatrace Operator version 0.2.0 or earlier, we recommend that you upgrade.
Run the following command.
oc apply -f https://github.com/Dynatrace/dynatrace-operator/releases/latest/download/openshift.yaml
For preview features, where you use the CSI driver to provide binaries to pods, use the command below instead.
oc apply -f https://github.com/Dynatrace/dynatrace-operator/releases/latest/download/openshift-csi.yaml
There are two ways to configure Dynatrace Operator to monitor your OpenShift cluster, (automated or manual. See below for instructions.
The instructions apply to OpenShift Dedicated as well. For OpenShift Dedicated, you need cluster-admin privileges.
Generate an API token and a PaaS token in your Dynatrace environment.
Make sure you have the following permissions enabled for the API token in the API v1 section:
oc adm new-project --node-selector="" dynatrace
# For OCP 3.11oc -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=unusedoc -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
.spec.tokens
). In the following code snippet, the name is dynakube
. Be sure to replace OPERATOR_TOKEN
and PAAS_TOKEN
with values as specified in the prerequisites.oc -n dynatrace create secret generic dynakube --from-literal="apiToken=OPERATOR_TOKEN" --from-literal="paasToken=PAAS_TOKEN"
curl -Lo cr.yaml https://github.com/Dynatrace/dynatrace-operator/blob/release-0.2/config/samples/cr.yaml
Example of a basic configuration:
apiVersion: dynatrace.com/v1alpha1kind: DynaKubemetadata:name: dynakubenamespace: dynatracespec:# Dynatrace apiUrl including the `/api` path at the end.# For SaaS, set `YOUR_ENVIRONMENT_ID` to your environment ID.# For Managed, change the apiUrl address.# For instructions on how to determine the environment ID and how to configure the apiUrl address, see environment-id.#apiUrl: https://YOUR_ENVIRONMENT_ID.live.dynatrace.com/api# Name of the secret holding the API and PaaS tokens.# If unset, Dynatrace Operator uses the name of the custom resource.## tokens: ""# Enables and configures an ActiveGate instance that allows monitoring# of Kubernetes environments.#kubernetesMonitoring:# Enable Kubernetes monitoring functionality.#enabled: trueclassicFullStack:# Enable classic oneagent monitoringenabled: truetolerations:- effect: NoSchedulekey: node-role.kubernetes.io/masteroperator: Exists
If you want to revert an argument, you need to set it to empty instead of removing it from the custom resource.
Example:
args:
For a complete list of parameters, see the list below.
Global parameters
apiUrl
/api
path at the end.YOUR_ENVIRONMENT_ID
to your environment ID.tokens
.metadata.name
) if unsetskipCertCheck
true
if you want to skip certification validation checks.false
proxy
proxy
.trustedCAs
certs
within your configmap.networkZone
customPullSecret
enableIstio
false
ActiveGate parameters
activeGate.image
OneAgent parameters
oneAgent.version
useImmutableImage
is enabled. The latest version is used by default.oneAgent.image
docker.io/dynatrace/oneagent
in Kubernetes and registry.connect.redhat.com/dynatrace/oneagent
in OpenShift.oneAgent.autoUpdate
true
Classic full-stack observability parameters
classicFullStack.enabled
false
classicFullStack.nodeSelector
classicFullStack.tolerations
classicFullStack.resources
resource.requests
shows the values needed to run; resource.limits
shows the maximum limits for the pod.classicFullStack.args
"--set-app-log-content-access=true"
classicFullStack.env
classicFullStack.priorityClassName
classicFullStack.dnsPolicy
ClusterFirstWithHostNet
classicFullStack.serviceAccountName
"dynatrace-dynakube-oneagent"
classicFullStack.labels
classicFullStack.useUnprivilegedMode
true
classicFullStack.useImmutableImage
false
Kubernetes API Monitoring parameters
kubernetesMonitoring.enabled
false
kubernetesMonitoring.replicas
1
kubernetesMonitoring.tolerations
kubernetesMonitoring.nodeSelector
kubernetesMonitoring.resources
resource.requests
shows the values needed to run; resource.limits
shows the maximum limits for the pod.kubernetesMonitoring.labels
kubernetesMonitoring.args
kubernetesMonitoring.env
kubernetesMonitoring.group
kubernetesMonitoring.customProperties
customProperties
. See Customize ActiveGate properties for details.Routing parameters
routing.enabled
false
For a complete file with all the properties, see the custom resource file on GitHub.
oc apply -f cr.yaml
cr.yaml
file in order to
There are two ways to provide the proxy, depending on whether 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.live.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
that holds your encrypted proxy URL with the credentials.
Example.
oc -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: DynaKubemetadata:name: dynakubenamespace: dynatracespec:apiUrl: https://environmentid.live.dynatrace.com/apiproxy:valueFrom: myproxysecret
Some Kubernetes pages require that your OpenShift cluster be connected to Dynatrace. This connection creates relationships among applications, services, processes, hosts, and Kubernetes objects such as pods and namespaces.
See Deploy ActiveGate using Dynatrace Operator for instructions on how to connect your cluster to Dynatrace.
If you want to monitor several OpenShift clusters with one ActiveGate and don't care about network isolation, you can install an ActiveGate on a virtual machine using a conventional installer, to connect your clusters in Dynatrace.
Dynatrace Operator needs permission to access the csi
volumes, which are used to provide the necessary binaries to different pods. To allow pods access to the csi
volumes you must add a security context constraint.
To add a security context constraint
restricted-csi.yaml
with the following content.You can configure the file according to your needs, just make sure you add csi
to the volumes
.
apiVersion: security.openshift.io/v1kind: SecurityContextConstraintsmetadata:name: restricted-csirunAsUser:type: MustRunAsRangeseLinuxContext:type: MustRunAsfsGroup:type: MustRunAssupplementalGroups:type: RunAsAnyallowHostDirVolumePlugin: trueallowHostIPC: falseallowHostNetwork: falseallowHostPID: falseallowHostPorts: falseallowPrivilegeEscalation: trueallowPrivilegedContainer: trueallowedCapabilities: nulldefaultAddCapabilities: nullpriority: nullreadOnlyRootFilesystem: falsegroups:- system:authenticatedrequiredDropCapabilities:- KILL- MKNOD- SETUID- SETGIDusers: []volumes:- configMap- downwardAPI- emptyDir- hostPath- persistentVolumeClaim- projected- secret- csi
oc apply -f restricted-csi.yaml
Contact a Dynatrace product expert via live chat if you want to monitor environments that are larger than:
Remove DynaKube custom resources and clean all remaining Dynatrace Operator–specific objects.