This guide walks you through installing the MW 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 MW Agent via Cluster IP address & ports (i.e. language-based APMs).


  • Kubernetes v1.21 or above

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


Follow the steps below to install the MW Agent in your Kubernetes environment.

  1. Log in to Middleware
  2. Navigate to the installation page, in the bottom left corner
  1. Get the current Kubernetes context and ensure that the cluster belonging to this context is the one where you wish to install MW Agent. Use the following command to find out your current Kubernetes context.
kubectl config get-contexts `kubectl config current-context`
  1. Copy and run the installation command. An example of the command is shown below. Copying the command directly from the Installation page ensures your API key and UID are inserted accurately.
MW_API_KEY=<xxxxxxxxxx> MW_TARGET=https://<uid>.middleware.io:443 bash -c "$(curl -L https://install.middleware.io/scripts/mw-kube-agent-install.sh)"
  1. Verify the status of the MW Agent with the following command.
kubectl get daemonset/mw-kube-agent -n mw-agent–ns
  1. 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.
Run only one MW Agent DaemonSet per cluster. Multiple agents will cause unexpected behavior.


The MW Agent is frequently updated to add new features and improve performance. More information on new features can be found in our Newsletter . To upgrade MW Agent, use the following command.

bash -c "$(curl -L https://install.middleware.io/scripts/mw-kube-agent-upgrade.sh)"


Once the MW 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.

For any issues please reach out to our team in your Slack channel or through the help menu in the Middleware Application.


To uninstall the Middleware Agent use the following command.

bash -c "$(curl -L https://install.middleware.io/scripts/mw-kube-agent-uninstall.sh)"