Defining the helm chart to install the Instana agent and pushing to the Git Repo
Chart.yaml:
apiVersion: v2
appVersion: 1.213.0
description: Instana Agent for Kubernetes
name: instana-agent
version: 1.2.32
type: application
dependencies:
- name: instana-agent
version: 1.2.32
repository: https://agents.instana.io/helm
values_apm2.yaml:
instana-agent:
agent:
endpointHost: ingress-pink-saas.instana.rocks
endpointPort: 443
cluster:
name: apm2
zone:
name: test
When the helm chart and values files are ready, you can commit the changes and push them to your git repository.
Defining ApplicationSet resource
Now you can go back to your Argo CD instance. As you may know, Argo CD provides ApplicationSet controller to manage deployments of a large number of applications, repositories, or clusters, all from a single Kubernetes resource.
If you have multiple clusters to deploy the Instana agent, you can define a ApplicationSet resource with Cluster generator as below.
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: appset-helm
spec:
generators:
- matrix:
generators:
- git:
revision: HEAD
directories:
- path: helm-charts/instana-agent
- clusters:
selector:
matchLabels:
argocd.argoproj.io/secret-type: cluster
template:
metadata:
name: '{{path.basename}}-{{name}}'
spec:
project: default
source:
targetRevision: HEAD
path: '{{path}}'
helm:
valueFiles:
- 'values_{{name}}.yaml'
destination:
server: '{{server}}'
namespace: '{{path.basename}}'
The ApplicationSet controller automatically generates Argo CD Applications for each cluster. You'll see new applications displayed with initial Missing and OutOfSync states in the Argo CD Applications dashboard.
Synchronizing Argo CD Applications
Click the SYNC button for the application "instana-agent-apm2", then a pop-up window is shown with synchronization options. Argo CD automatically detects differences between the desired manifests in Git and the live state in the cluster, and marks those out-of-sync resources with yellow icon. Make sure all OutOfSync resources are selected then click the SYNCHRONIZE button.
After a while, all Kubernetes resources are created and the application is shown as Healthy and Synced. The Instana agent has been deployed successfully.
You can perform the same SYNC actions for other ArgoCD applications. Then Instana agents can be deployed to all other clusters.
Changing Instana agent configuration
If you would like to change the agent configuration for all your clusters–such as requested memory allocation for agent pods–you can change the basic values.yaml file in the git repository directly.
pod:
requests:
# agent.pod.requests.memory is the requested memory allocation in MiB for the agent pods.
memory: 768Mi
# agent.pod.requests.cpu are the requested CPU units allocation for the agent pods.
cpu: 0.5
limits:
# agent.pod.limits.memory set the memory allocation limits in MiB for the agent pods.
memory: 1024Mi
# agent.pod.limits.cpu sets the CPU units allocation limits for the agent pods.
cpu: 1.5
Then this git change will be detected by Argo CD and be applied to all your clusters according to the synchronization policy.
Conclusion
GitOps provides benefits of fast deployment, quick detection and apply of configuration changes, easy rollback and recovery for infrastructure and cloud native applications. You can leverage GitOps to carry out large-scaled Instana agent deployment and management, which helps improve operation tasks in a more efficient way.