---
title: Tutorial: Monitor Redis running on Kubernetes
source: https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/advanced-configuration/monitor-services/tutorial-monitor-redis-running-kubernetes
---

> #### 💡 TIP
>
> This tutorial applies to the [Kubernetes integration v3](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/advanced-configuration/k8s-version2/changes-since-v3) [installed using Helm](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/installation/install-kubernetes-integration-using-helm). For instructions on how to do this on v2 using helm please check [this section](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/advanced-configuration/k8s-version2/overview/#monitor-services). To check how to configure services on top of plain manifest, check out [this other page](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/advanced-configuration/monitor-services/monitor-services-running-kubernetes#config-details).

If you have a service running on Kubernetes, and it's a [service we support](https://docs.newrelic.com/docs/monitor-service-running-kubernetes#integration-configs), you can enable monitoring of that service by adding a configuration section for that integration to the Kubernetes integration's config.

This tutorial shows how to enable monitoring for a Redis service running on the Kubernetes PHP Guestbook. For the general procedure, see [Monitor a Kubernetes-running service](https://docs.newrelic.com/docs/monitor-service-running-kubernetes).

## What you need [#requirements]

-   See the [general requirements for this feature](https://docs.newrelic.com/docs/monitor-service-running-kubernetes#requirements), including supported services.
-   The `kubectl` command-line tool must be configured to communicate with your cluster. If you don't have a cluster, you can create one using [Minikube](https://kubernetes.io/docs/setup/minikube).

## Step 1: Set up an example Redis application [#set-up-redis]

This tutorial builds on the Kubernetes tutorial [Deploying a PHP Guestbook application with Redis](https://kubernetes.io/docs/tutorials/stateless-application/guestbook/). Skip the Kubernetes tutorial and run the following command to set up the application needed for our tutorial:

```shell
kubectl create -f https://raw.githubusercontent.com/kubernetes/examples/master/guestbook/all-in-one/guestbook-all-in-one.yaml
```

If you'd like to first complete the [Kubernetes tutorial](https://kubernetes.io/docs/tutorials/stateless-application/guestbook/), follow their tutorial instructions but do **not** follow the instructions in the **Cleaning up** section.

## Step 2: Enable monitoring of Redis instances [#monitor-redis]

The PHP Guestbook application has three Redis instances: one master and two replica instances. Each instance is tagged with a label where `app=redis`. For this example, we're using our [Redis monitoring integration](https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/redis-monitoring-integration). It can monitor both master and replica instances of Redis, so we don’t have to distinguish between them.

1.  In the `values-newrelic.yaml` YAML file for our [helm chart](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/installation/install-kubernetes-integration-using-helm) you need to update the `newrelic-infrastructure.integrations` section. From [the list of integration configs](https://docs.newrelic.com/docs/monitor-service-running-kubernetes#integration-configs), get the Redis integration YAML and add it to the Kubernetes config. The Redis-specific configuration is contained under the `redis-config.yml:` key:

    ```yaml
    newrelic-infrastructure:
      integrations:
        redis-config.yml:
          # Run auto discovery to find pods with label "app=redis"
          # https://docs.newrelic.com/docs/integrations/host-integrations/installation/container-auto-discovery
          discovery:
            command:
              # Run discovery for Kubernetes. Use the following optional arguments:
              # --namespaces: Comma separated list of namespaces to discover pods on
              # --tls: Use secure (TLS) connection
              # --port: Port used to connect to the kubelet. Default is 10255
              exec: /var/db/newrelic-infra/nri-discovery-kubernetes --tls --port 10250
              match:
                label.app: redis
          integrations:
            - name: nri-redis
              env:
                # using the discovered IP as the hostname address
                HOSTNAME: ${discovery.ip}
                PORT: 6379
                KEYS: '{"0":["<KEY_1>"],"1":["<KEY_2>"]}'
                labels:
                  env: production
    ```

2.  Deploy the updated service:

    ```shell
    helm upgrade --install newrelic newrelic/nri-bundle \
    --namespace newrelic --create-namespace \
    -f values-newrelic.yaml \
    --devel
    ```

    You should be able to see the following in the logs for the `nrk8s-kubelet` pod that is scheduled in the same node as the service you want to monitor:

    ```shell
    kubectl logs -n newrelic newrelic-nrk8s-kubelet-xxxxx agent
    ```

    ```
    time="2019-12-23T17:37:07Z" level=info msg="Integration health check starting" instance=redis-metrics integration=com.newrelic.redis prefix=integration/com.newrelic.redis working-dir=/var/db/newrelic-infra/newrelic-integrations
    time="2019-12-23T17:37:07Z" level=info msg="Integration health check finished with success" instance=redis-metrics integration=com.newrelic.redis prefix=integration/com.newrelic.redis working-dir=/var/db/newrelic-infra/newrelic-integrations
    ```

If there are no errors, you should see Redis data in the infrastructure UI. To find the Redis dashboards, go to **[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > Infrastructure > Third party services**, and select the **Redis** dashboard.

For the general procedure of how to monitor services running on Kubernetes, including more detail about how configuration works, see [Monitor a Kubernetes-running service](https://docs.newrelic.com/docs/monitor-service-running-kubernetes).
