This guide walks you through installing the Infrastructure Agent (Infra Agent) in a Kubernetes environment. These instructions can also be found on the Installation page in the Middleware application.

The installation will set up a DaemonSet inside your Kubernetes cluster and add necessary components to appropriately permission the DaemonSet pods. A Kubernetes service is also created to allow components to connect to the Infra Agent via Cluster IP address and ports (i.e. language-based APMs).



Kubernetes Version

Kubernetes version 21.0.0 or above. Check with the following command:

kubectl version

Kubernetes Access

Access to Kubernetes cluster and client (i.e. kubectl)


CLI Tools

Install bash, curl and wget


Step 1: Access Kubernetes Installation

Log in to Middleware, navigate to the Installation Page in the bottom left corner and select Kubernetes from the Infrastructure section

"Agent Installation"

Step 2: Identify Kubernetes Context

Get the current Kubernetes Context and ensure the cluster belonging to this Context is where you want to install the Infra Agent.

Use the following command to find out your current Kubernetes context:

kubectl config get-contexts `kubectl config current-context`

Step 3: Run Kubernetes Install Command

Install the Infra Agent with Bash or .bat. Copying the command directly from the Installation page ensures your API key and Target is inserted correctly.

If you are installing the Infra Agent with Microsoft PowerShell, proceed to the Kubernetes with MS PowerShell document.

Step 3a: Install with Bash

MW_API_KEY=<xxxxxxxxxx> MW_TARGET=https://<uid> bash -c "$(curl -L"

Step 3b: Install with .bat

Download the Infra Agent batch file here. Open PowerShell, change the directory to the location of the download, and execute the following commands:




Step 4: Add Host Tags [Optional]

Create filterable custom tags by adding the MW_HOST_TAGS environment variable to the installation command as comma-separated key-value pairs. Use the tag name to create an alias for the host (e.g. production).

Check your host tags have been embedded by navigating to Infrastructure -> Your Desired Host -> System Information
MW_HOST_TAGS=key1:value1,key2:value2,... MW_API_KEY=...

Step 5: Verify Installation

Verify the status of the Infra Agent with the following command:

kubectl get daemonset/mw-kube-agent -n mw-agent-ns

Step 6: Check Your Dashboard

Navigate to Middleware and ensure metrics are appearing in the Unified Dashboard . Depending on the size of your cluster, it can take up to a few minutes for metrics to appear. If metrics do not appear after this time head to our troubleshooting page for some common issues.


The Infra Agent is frequently updated to add new features and improve performance. More information on new features can be found in our Newsletter .

To upgrade Infra Agent, use the following command:

bash -c "$(curl -L"


Run only one Infra Agent DaemonSet per cluster per host. Multiple agents will cause unexpected behavior.

Once the Infra Agent is installed on your cluster metrics should begin appearing in the Middleware application within a few minutes. If metrics do not appear, confirm that Kubernetes has access to the internet, either directly or through a proxy, and that only one MW Agent is running per cluster.

Switching Between Contexts

If you are using another thirdy-party resource for managing your Kubernetes Infrastructure (e.g. Lens) it’s possible your cluster names are similar across clusters. This will make it hard to delineate between the clusters inside of Middleware.

To fix this, you can force a speicific by setting the MW_KUBE_CLUSTER_NAME environment variable to the name(s) you are using in your thrid party resource. Once the cluster is renamed, it will automatically reset and start to catch the appropriately labeled environment variables.


To uninstall the Infra Agent use the following command:

bash -c "$(curl -L"
Need assistance or want to learn more about Middleware? Contact us at support[at]