Deploy ActiveGate in OpenShift as a StatefulSet
Dynatrace Operator manages the lifecycle of several Dynatrace components, including ActiveGate. If you can't use Dynatrace Operator, you can deploy the ActiveGate directly as a StatefulSet. See below for instructions.
Prerequisites
- Create a PaaS token
- Create a dedicated namespace.
oc adm new-project --node-selector="" dynatrace
- Create a secret holding the environment URL and login credentials for this registry.
Example command:
oc -n dynatrace create secret docker-registry dynatrace-docker-registry --docker-server=<YOUR_ENVIRONMENT_URL> --docker-username=<YOUR_ENVIRONMENT_ID> --docker-password=<YOUR_PAAS_TOKEN> -n dynatrace
where you need to replace
<YOUR_ENVIRONMENT_URL>
with your environment URL (without 'http'). Example:environment.live.dynatrace.com
<YOUR_ENVIRONMENT_ID>
with the docker account username (same as the ID in your environment URL above)<YOUR_PAAS_TOKEN>
with the PaaS token you created in Prerequisites.
- Create a file named
ag.yaml
with the following content, making sure to replace
<YOUR_ENVIRONMENT_URL>
and<YOUR_ENVIRONMENT_ID>
with your own values as described above<ANY_UNIQUE_ID>
with any unique value. This ID will be used by the ActiveGate to generate a unique name in the UI.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: dynatrace-activegate-kubernetes-monitoring
namespace: dynatrace
labels:
activegate: kubernetes-monitoring
spec:
serviceName: ""
selector:
matchLabels:
activegate: kubernetes-monitoring
template:
metadata:
labels:
activegate: kubernetes-monitoring
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: beta.kubernetes.io/arch
operator: In
values:
- amd64
- key: beta.kubernetes.io/os
operator: In
values:
- linux
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- key: kubernetes.io/os
operator: In
values:
- linux
containers:
- name: activegate
image: <YOUR_ENVIRONMENT_URL>/linux/activegate
imagePullPolicy: Always
env:
- name: DT_ID_SEED_NAMESPACE
value: dynatrace
- name: DT_ID_SEED_K8S_CLUSTER_ID
value: <ANY_UNIQUE_ID>
args:
- --enable=kubernetes_monitoring
livenessProbe:
failureThreshold: 2
httpGet:
path: /rest/state
port: 9999
scheme: HTTPS
initialDelaySeconds: 30
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /rest/health
port: 9999
scheme: HTTPS
initialDelaySeconds: 30
periodSeconds: 15
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 300m
memory: 1G
requests:
cpu: 150m
memory: 250M
imagePullSecrets:
- name: dynatrace-docker-registry
updateStrategy:
type: RollingUpdate
- Deploy ActiveGate.
oc apply -f ag.yaml
Connect your OpenShift clusters to Dynatrace
- Create a service account and cluster role.
Create a service account and cluster role for accessing the Kubernetes API. This creates the bearer token necessary to authenticate in the Kubernetes API. Use the following snippet.
oc apply -f https://www.dynatrace.com/support/help/codefiles/kubernetes/kubernetes-monitoring-service-account.yaml
- Get the Kubernetes API URL.
$ oc config view --minify -o jsonpath='{.clusters[0].cluster.server}'
- Get the bearer token.
oc get secret $(oc get sa dynatrace-monitoring -o jsonpath='{.secrets[0].name}' -n dynatrace) -o jsonpath='{.data.token}' -n dynatrace | base64 --decode
oc get secret $(oc get sa dynatrace-monitoring -o jsonpath='{.secrets[1].name}' -n dynatrace) -o jsonpath='{.data.token}' -n dynatrace | base64 --decode
```
- Go to Settings > Cloud and virtualization > Kubernetes, and select Connect new cluster.
- Provide a Name, Kubernetes API URL, and the Bearer token for the OpenShift cluster.
Once you connect your OpenShift clusters to Dynatrace, you can get native Kubernetes metrics, like request limits, and differences in pods requested vs. running pods.