With many companies today adopting GitOps for streamlined Kubernetes deployments, there's a growing interest in applying these practices to Dynatrace components. This guide focuses on deploying Dynatrace Operator with GitOps tools and setting up monitoring efficiently using the DynaKube custom resource (CR), aligning with modern deployment strategies.
This section discusses deploying Dynatrace Operator and applying a DynaKube CR using ArgoCD. Additionally, it outlines options and tips for flexible integration with ArgoCD.
The following three points describe Dynatrace deployment options outlined by the subsections and combinations of them.
This guide was developed and tested with ArgoCD version 2.10.3.
The following ArgoCD Application defines Dynatrace Operator deployment using the OCI-based Helm chart from Amazon ECR:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:name: dynatrace-operatornamespace: argocdspec:project: defaultdestination:server: https://kubernetes.default.svcnamespace: dynatracesource:repoURL: public.ecr.aws/dynatracechart: dynatrace-operatortargetRevision: 1.0.0helm: {}
For deployment customization via Helm values, please refer to ArgoCD's Helm user guide.
The Application CR can be applied in the following ways:
To use ApplicationSet CRs for multi-cluster deployments, use the Application CR from above as a template and integrate it into an ApplicationSet CR according to ArgoCD's official documentation.
The following ArgoCD Application references a Git repository holding a DynaKube CR under the specified filepath:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:name: dynakubenamespace: argocdspec:project: defaultdestination:server: https://kubernetes.default.svcnamespace: dynatracesource:repoURL: <git-reopository-url>targetRevision: <revision>path: <path-to-dynakube-dir>
Replace the repoURL
, targetRevision
, and path
source fields with meaningful values before applying the Application CR in either of these ways:
For details on DynaKube CR configuration, see the deployment options documentation.
ArgoCD's App Of Apps pattern describes a very common approach in the ArgoCD community enabling automatic cluster bootstrapping. In combination with Sync Phases and Waves, the App of Apps pattern provides sequential control over Application synchronization required for deploying Dynatrace Operator before applying a DynaKube CR 1.
Add the argocd.argoproj.io/sync-wave
annotation with the respective value to the Application CRs from the above sections as illustrated in the following snippet:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:annotations:argocd.argoproj.io/sync-wave: "0"name: dynatrace-operatornamespace: argocdspec:...---apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:annotations:argocd.argoproj.io/sync-wave: "10"name: dynakubenamespace: argocdspec:...
Both Application CRs are meant to be applied via the App of Apps pattern (which requires a parent Application CR).
Creating Custom Resource Definitions (CRDs) installed via the Helm chart can take several seconds, leading to the possibility that the initial application of the DynaKube CR will fail. To circumvent the given race condition, we recommend configuring ArgoCD for the use of App of Apps by changing the health assessment logic for Applications. Alternatively, automatic retries of synchronizations can be configured.
Multiple sources for an Application is an ArgoCD beta feature and is subject to change in backwards-incompatible ways, according ArgoCD documentation.
Multiple sources for an Application enables you to use a single ArgoCD Application for deployment of Dynatrace Operator and DynaKube CR. Additionally, the feature allows Helm value files to be sources from a Git repository other than the Helm chart itself, which was not possible in ArgoCD before.
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:name: dynatracenamespace: argocdspec:project: defaultdestination:server: https://kubernetes.default.svcnamespace: dynatracesources:- repoURL: public.ecr.aws/dynatracechart: dynatrace-operatortargetRevision: 1.0.0helm:valueFiles:- $values/<path-to-dynatrace-operator-values-file>- repoURL: <git-repository-url>targetRevision: HEADref: values- repoURL: <git-repository-url>targetRevision: HEADpath: <path-to-dynakube-dir>syncPolicy:retry: # sample retry configuration; for details, see footnote belowlimit: 5......
Before applying, replace all placeholders with meaningful values and configure automatic retries2.
Creating Custom Resource Definitions (CRDs) installed via the Helm chart can take several seconds, leading to the possibility of the initial application of the DynaKube resource failing. To ensure successful deployment, you need to configure retries by specifying a sync policy.
For configuring automatic updates for Dynatrace Operator, see Auto-update of Dynatrace Operator, which explains integrating GitOps with dependency automation tools.