Manually deploy ActiveGate as a StatefulSet
Dynatrace Operator manages the lifecycle of several Dynatrace components, including ActiveGate. If you can't use Dynatrace Operator, you can manually deploy ActiveGate as a StatefulSet in your Kubernetes cluster. See below for instructions.
Prerequisites
-
Create an access token with
PaaS Integration - InstallerDownload
scope -
Get your kube-system namespace UUID
Run the command below and save the UUID from the output for later use.
1kubectl get namespace kube-system -o jsonpath='{.metadata.uid}'
Deploy ActiveGate
To deploy ActiveGate, follow the steps below.
-
Create a dedicated namespace (Kubernetes)/project (OpenShift).
Depending on your platform, select one of the options below.
1kubectl create namespace dynatrace -
Create two secrets:
A secret holding the environment URL and login credentials for this registry
A secret for the ActiveGate authentication token
1kubectl -n dynatrace create secret docker-registry dynatrace-docker-registry --docker-server=<YOUR_ENVIRONMENT_URL> --docker-username=<YOUR_ENVIRONMENT_ID> --docker-password=<YOUR_PAAS_TOKEN>where you need to replace
-
<YOUR_ENVIRONMENT_URL>
with your environment URL (without 'http'). Example:{your-environment}.live.dynatrace.com
-
<YOUR_ENVIRONMENT_ID>
with the Docker account username (same as the ID in your environment URL above).
To determine your environment ID, see the syntax below.
SaaS:https://{your-environment-id}.live.dynatrace.com
Managed:https://{your-domain}/e/{your-environment-id}
<YOUR_PAAS_TOKEN>
with the PaaS token you created in Prerequisites
-
Create a service account and a cluster role.
Create a
kubernetes-monitoring-service-account.yaml
file with the following content.1apiVersion: v12kind: ServiceAccount3metadata:4 name: dynatrace-activegate5 namespace: dynatrace6---7apiVersion: rbac.authorization.k8s.io/v18kind: ClusterRole9metadata:10 name: dynatrace-activegate11rules:12- apiGroups:13 - ""14 - batch15 - apps16 - apps.openshift.io17 resources:18 - nodes19 - nodes/metrics20 - pods21 - namespaces22 - deployments23 - replicasets24 - deploymentconfigs25 - replicationcontrollers26 - jobs27 - cronjobs28 - statefulsets29 - daemonsets30 - events31 - resourcequotas32 - pods/proxy33 - services34 verbs:35 - list36 - watch37 - get38---39apiVersion: rbac.authorization.k8s.io/v140kind: ClusterRoleBinding41metadata:42 name: dynatrace-activegate43roleRef:44 apiGroup: rbac.authorization.k8s.io45 kind: ClusterRole46 name: dynatrace-activegate47subjects:48- kind: ServiceAccount49 name: dynatrace-activegate50 namespace: dynatrace -
Apply the file.
1kubectl apply -f kubernetes-monitoring-service-account.yaml -
Create a file named
ag-monitoring-and-routing.yaml
with the following content, making sure to replace<YOUR_ENVIRONMENT_URL>
with your value as described above.<YOUR_KUBE-SYSTEM_NAMESPACE_UUID>
with the Kubernetes namespace UUID obtained in Prerequisites.
1apiVersion: v12kind: Service3metadata:4 name: dynatrace-activegate5 namespace: dynatrace6spec:7 type: ClusterIP8 selector:9 activegate: kubernetes-monitoring-and-routing10 ports:11 - protocol: TCP12 port: 44313 targetPort: ag-https14---15apiVersion: apps/v116kind: StatefulSet17metadata:18 name: dynatrace-activegate19 namespace: dynatrace20 labels:21 activegate: kubernetes-monitoring-and-routing22spec:23 serviceName: ""24 selector:25 matchLabels:26 activegate: kubernetes-monitoring-and-routing27 template:28 metadata:29# Uncomment the lines below to enable AppArmor30# annotations:31# container.apparmor.security.beta.kubernetes.io/activegate: runtime/default32 labels:33 activegate: kubernetes-monitoring-and-routing34 spec:35 serviceAccountName: dynatrace-activegate36 affinity:37 nodeAffinity:38 requiredDuringSchedulingIgnoredDuringExecution:39 nodeSelectorTerms:40 - matchExpressions:41 - key: kubernetes.io/arch42 operator: In43 values:44 - amd6445 - key: kubernetes.io/os46 operator: In47 values:48 - linux49 containers:50 - name: activegate51 image: <YOUR_ENVIRONMENT_URL>/linux/activegate52 imagePullPolicy: Always53 ports:54 - name: ag-https55 containerPort: 999956 env:57 - name: DT_ID_SEED_NAMESPACE58 value: dynatrace59 - name: DT_ID_SEED_K8S_CLUSTER_ID60 value: <YOUR_KUBE-SYSTEM_NAMESPACE_UUID>61 - name: DT_CAPABILITIES62 value: kubernetes_monitoring,MSGrouter,restInterface63 # - name: DT_NETWORK_ZONE64 # value: <CUSTOM_NZ>65 - name: DT_DNS_ENTRY_POINT66 value: https://$(DYNATRACE_ACTIVEGATE_SERVICE_HOST):$(DYNATRACE_ACTIVEGATE_SERVICE_PORT)/communication67 volumeMounts:68 - name: dynatrace-tokens69 mountPath: /var/lib/dynatrace/secrets/tokens70 - name: truststore-volume71 mountPath: /opt/dynatrace/gateway/jre/lib/security/cacerts72 readOnly: true73 subPath: k8s-local.jks74 - name: ag-lib-gateway-config75 mountPath: /var/lib/dynatrace/gateway/config76 - name: ag-lib-gateway-temp77 mountPath: /var/lib/dynatrace/gateway/temp78 - name: ag-lib-gateway-data79 mountPath: /var/lib/dynatrace/gateway/data80 - name: ag-log-gateway81 mountPath: /var/log/dynatrace/gateway82 - name: ag-tmp-gateway83 mountPath: /var/tmp/dynatrace/gateway84 livenessProbe:85 failureThreshold: 286 httpGet:87 path: /rest/state88 port: ag-https89 scheme: HTTPS90 initialDelaySeconds: 3091 periodSeconds: 3092 successThreshold: 193 timeoutSeconds: 194 readinessProbe:95 failureThreshold: 396 httpGet:97 path: /rest/health98 port: ag-https99 scheme: HTTPS100 initialDelaySeconds: 30101 periodSeconds: 15102 successThreshold: 1103 timeoutSeconds: 1104 resources:105 requests:106 cpu: 250m107 memory: 512Mi108 limits:109 cpu: 250m110 memory: 512Mi111 securityContext:112 allowPrivilegeEscalation: false113 capabilities:114 drop:115 - all116 privileged: false117 readOnlyRootFilesystem: true118 runAsNonRoot: true119 seccompProfile:120 type: RuntimeDefault121 initContainers:122 - name: certificate-loader123 image: YOUR_ENVIRONMENT_URL>/linux/activegate124 workingDir: /var/lib/dynatrace/gateway125 command: ['/bin/bash']126 args: ['-c', '/opt/dynatrace/gateway/k8scrt2jks.sh']127 volumeMounts:128 - mountPath: /var/lib/dynatrace/gateway/ssl129 name: truststore-volume130 imagePullSecrets:131 - name: dynatrace-docker-registry132 volumes:133 - name: dynatrace-tokens134 secret:135 secretName: dynatrace-tokens136 - name: truststore-volume137 emptyDir: {}138 - name: ag-lib-gateway-config139 emptyDir: {}140 - name: ag-lib-gateway-temp141 emptyDir: {}142 - name: ag-lib-gateway-data143 emptyDir: {}144 - name: ag-log-gateway145 emptyDir: {}146 - name: ag-tmp-gateway147 emptyDir: {}148 updateStrategy:149 type: RollingUpdateSee below for a list of proposed sizes in relation to the number of pods:
Number of pods CPU Memory Up to 100 pods 500 millicores (mCores) 512 mebibytes (MiB) Up to 1,000 pods 1,000 millicores (mCores) 1 gibibyte (GiB) Up to 5,000 pods 1,500 millicores (mCores) 2 gibibytes (GiB) Over 5,000 pods over 1,500 millicores (mCores)1 over 2 gibibytes (GiB)1 1Actual figures depend on your environment.
These limits should be taken as a guideline. They're designed to prevent ActiveGate startup process slowdown and excessive node resource usage. The default values cover a large range of different cluster sizes; you can modify them according to your needs, based on the ActiveGate self-monitoring metrics.
-
Deploy ActiveGate.
1kubectl apply -f ag-monitoring-and-routing.yaml
Connect ActiveGate with Kubernetes API
Continue with step 3 from the guide for enabling Kubernetes API monitoring
ActiveGate update behavior
ActiveGate is updated automatically on pod restart whenever there is a new version available, unless the image already specifies a certain version.