Kubernetes

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).

Prerequisites

1 Kubernetes Version

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

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

3 CLI Tools

Install bash, curl and wget

Install

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

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:

Step 3: Run Kubernetes Install Command

Install the Infra Agent with Bash, .bat or Helm. 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

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 3b: Install with Helm

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

Step 5: Verify Installation

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

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.

Upgrade

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:

Troubleshooting

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 cluster.name 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.

Uninstall

To uninstall the Infra Agent use the following command:

If you installed the agent via Helm chart, you can uninstall via the following command:

Need assistance or want to learn more about Middleware? Contact our support team in Slack.