Kubernetes Agent with ArgoCD
This guide walks you through installing the Infrastructure Agent (Infra Agent) in Kubernetes environment using ArgoCD. ArgoCD provides a GitOps approach to deploying and managing the Middleware agent with declarative configuration and automated synchronization.
Prerequisites
1 Kubernetes Cluster with ArgoCD
A running Kubernetes cluster with ArgoCD installed and configured.
Verify ArgoCD is running:
kubectl get pods -n argocd
2 Kubernetes Access
Access to Kubernetes cluster and client (i.e. kubectl)
kubectl
version should be >= v1.17.0
. You can verify the current version via this command:
kubectl version --client
3 ArgoCD CLI (Optional)
Install ArgoCD CLI for command-line operations and complete the login process (optional, can also use ArgoCD UI)
Verify ArgoCD CLI installation:
argocd version
Installation Methods
Method 1: ArgoCD UI Configuration
This method uses the ArgoCD web interface to create and manage your Middleware agent deployment
Step 1: Generate Values Configuration
First, generate the Helm values configuration for your Middleware agent.
MW_API_KEY="<MW_API_KEY>" MW_TARGET=https://<MW_UID>.middleware.io:443 bash -c "$(curl -L https://install.middleware.io/scripts/generate-helm-values.sh)"
Example generated_values.yaml
configuration:
global: mw: apiKey: <MW_API_KEY> target: https://<MW_UID>.middleware.io:443 clusterMetadata: name: your-cluster-name # Override mw-autoinstrumentation: enabled: false
Cluster name is auto-detected from Kubernetes context. Override if not detected or want to change the default name .
Step 2: Create ArgoCD Application via UI
- Access your ArgoCD UI (typically available at
https://your-argocd-server
) - Click "New App" to create a new application
- Fill in the following configuration:
General Settings:
- Application name:
mw-agent
(or your preferred name) - Project name:
default
(or your target project) - Sync Policy:
Manual
(recommended for initial setup)
Source Settings:
- Repository URL:
https://helm.middleware.io
- Chart:
mw-kube-agent-v3
- Change the dropdown from "GIT" to "HELM"
- Version: Latest stable version (avoid older versions)
Destination Settings:
- Cluster URL:
https://kubernetes.default.svc
(for same cluster as ArgoCD) - Namespace:
mw-agent-ns

Step 3: Configure Helm Values
- In the "Parameters" section, change the category from "Directory" to "Helm"
- Paste your
generated_values.yaml
configuration into the "VALUES" field (not "VALUES FILES")
Make sure you fill in the VALUES field, not VALUES FILES

Step 4: Add Ignore Differences
Click "Edit as YAML" and add the following ignoreDifferences
section to prevent sync issues with ConfigMaps:
ignoreDifferences: - group: "" kind: ConfigMap name: mw-deployment-otel-config namespace: mw-agent-ns jsonPointers: - /data - group: "" kind: ConfigMap name: mw-daemonset-otel-config

Step 5: Deploy and Sync
- Click "CREATE" to create the application
- Click "SYNC" to deploy the Middleware agent
- Select "Synchronize" to apply all resources

Method 2: Declarative Configuration
Generate the Helm values file for the MW Agent as outlined above, then commit and push it to your Git repository.
After that, create an ArgoCD Application that points to this values file
apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: mw-agent namespace: argocd spec: project: default source: repoURL: https://helm.middleware.io targetRevision: 1.2.0
Apply the configuration:
kubectl apply -f middleware-argocd-app.yaml
Verification
Option 1: Check ArgoCD Application Status
Verify the application is healthy in ArgoCD UI or via CLI:
argocd app get mw-agent
Option 2: Verify Kubernetes Resources
Check that the Middleware agent pods are running:
kubectl get pods -n mw-agent-ns

Option 3: Validate Middleware Dashboard
Navigate to your Middleware dashboard and confirm that metrics are appearing. It may take a few minutes for data to start flowing.
Upgrade
Via ArgoCD UI
- Navigate to your Middleware application in ArgoCD UI
- Click on the application name
- Click "APP DETAILS" and then "EDIT"
- Update the target revision to the desired version
- Click "SAVE" and then "SYNC"


Via Declarative Configuration
Update the targetRevision
in your Application manifest and apply:
kubectl apply -f middleware-argocd-app.yaml
Common Issues
Application Not Syncing:
- Check ArgoCD has proper permissions to access the target namespace
- Verify the Helm chart repository is accessible
- Review ArgoCD application events for specific error messages
Pods Not Starting:
- Check resource quotas in the target namespace
- Review pod logs:
kubectl logs -n mw-agent-ns -l app=mw-kube-agent
No Metrics in Dashboard:
- Confirm Kubernetes cluster has internet access
- Verify API key and target are correct
- Check agent logs for connection errors
- Ensure only one MW Agent is running per node
ArgoCD-Specific Issues
Continuous Out-of-Sync Status: Ensure ignoreDifferences
is properly configured for ConfigMaps that are dynamically updated by the agent.
Permission Denied: Verify ArgoCD has proper RBAC permissions to create resources in the mw-agent-ns
namespace.
Uninstall
Via ArgoCD UI
- Navigate to the Middleware application in ArgoCD UI
- Click "DELETE"
- Confirm deletion by typing the application name

Via ArgoCD CLI
argocd app delete mw-agent
Via kubectl (if using declarative configuration)
kubectl delete application mw-agent -n argocd
Deleting the ArgoCD application will automatically remove all Kubernetes resources created by the Middleware agent,
Need assistance or want to learn more about Middleware? Contact our support team at [email protected].