> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/npp/3.0/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/npp/3.0/tutorials/deploy-mtr-monitor.md).

# Deploy MTR Monitor

This tutorial describes how to install and configure the MTR Monitor probe on the Kubernetes cluster. MTR Monitor constantly executes MTR tests in the cluster environment and exposes results as Prometheus metrics.

## Prerequisites

- [NPP installed](https://docs.cennso.com/components/npp/3.0/installation.md) on a Kubernetes cluster
- kubectl

## Steps

1. Create a namespace for your configuration:

    ```bash
    kubectl create namespace mtr-monitor-tutorial
    ```

1. Deploy the test application where the probe will be injected:

    ```bash
    kubectl create deployment nginx --image=nginx --namespace mtr-monitor-tutorial
    ```

1. Create a MTR Monitor manifest and configure it according to your needs. To do so, create a YAML file with the following MTRMonitor CustomResource (CR):

    ```yaml
    apiVersion: probe.cennso.com/v1alpha1
    kind: MTRMonitor
    metadata:
      name: mtr-monitor-sample
    spec:
      podSelector:
        labels:
          app: nginx
      container: nginx
      imagePullSecrets:
        - name: regcred
      interval: 30s
      timeout: 5s
      configurations:
        - name: MTR from any interface
          source: 0.0.0.0
          packets: 1
          maxUnknownHops: 5
          hopSleep: 10ms
          maxHops: 10
          targets:
            - address: 8.8.8.8
              name: Google DNS server
    ```

1. Apply the CR to the cluster by running this command:

    ```bash
    kubectl apply --namespace mtr-monitor-tutorial -f {FILENAME}.yaml
    ```

## Verification

1. Run this command to check if MTR Monitor is running:

    ```bash
    kubectl get mtrmonitor.probe.cennso.com mtr-monitor-sample --namespace mtr-monitor-tutorial
    ```

   If the deployment is successful, the output shows that it is configured, deployed and ready:

    ```bash
    NAME                 CONFIGURED   DEPLOYED   READY   AGE
    mtr-monitor-sample   True         True       True    1m
    ```

1. MTR statistics are available as Prometheus metrics exposed on the `9100` port.
