Install Kubernetes events integration

BETA

The New Relic Kubernetes events integration watches for events happening in your Kubernetes clusters and sends those events to New Relic. Visualize your event data in the New Relic One platform through the Kubernetes cluster explorer or Infrastructure Events UI.

This feature is currently in beta.

By using this beta integration, you agree to the terms and conditions of New Relic’s pre-GA program. Your use of the beta integration is at your own risk. For additional information about this beta integration, please contact Martin Fuentes or JF Joly, Product Managers.

Requirements

The Kubernetes events integration requires:

  • New Relic Kubernetes integration installed and activated.
  • Kubernetes pod with two containers, one used to capture events in the Kubernetes cluster and the other to forward the events to New Relic.

Install the Kubernetes events integration

To install the New Relic Kubernetes events integration in a Kubernetes environment:

  1. Download the integration manifest YAML file:

    curl -O https://download.newrelic.com/infrastructure_agent/integrations/kubernetes/nri-kube-events-0.0.2.yaml
  2. Edit the nri-kube-events-0.0.2.yaml manifest file, adding both a cluster name, to identify your Kubernetes cluster (required), and your New Relic license key (required).

    clusterName: "YOUR_CLUSTER_NAME"
    [...]
    	- name: "NRIA_LICENSE_KEY"
    	value: "YOUR_LICENSE_KEY" 
  3. Deploy the integration in your Kubernetes cluster:

    kubectl apply -f nri-kube-events-0.0.2.yaml
  4. To confirm that the integration has been configured correctly, wait a few minutes, then go to one.newrelic.com > Chart builder, and run the following NRQL query to see if data has been reported:

    FROM Metric SELECT count(*) WHERE clusterName = 'YOUR_CLUSTER_NAME' since 1 hour ago

View and query your Kubernetes events

Once you have successfully installed the Kubernetes event integration, access your events with one of the following methods:

Add events to your dashboards

To add events to your New Relic One Dashboard:

  1. Add a chart to a new or existing dashboard or create a chart using the chart builder.
  2. When creating or updating your chart, select the chart type table and use the following event query, replacing YOUR_CLUSTER_NAME with the name of your cluster:

    FROM InfrastructureEvent SELECT
    event.involvedObject.kind,event.involvedObject.name,event.reason,event.message 
    WHERE clusterName = 'YOUR_CLUSTER_NAME' limit 100
Query events with chart builder

Below are a few examples on querying your data with chart builder:

Get attributes names

To see all the attributes names, use the following query:

FROM InfrastructureEvents SELECT keyset() WHERE category = 'kubernetes'

See event details

To see details about the latest events in a cluster, use the following query, replacing YOUR_CLUSTER_NAME with the name of your cluster:

FROM InfrastructureEvent SELECT event.involvedObject.kind, 
event.involvedObject.name, event.type, event.message, event.reason WHERE 
category = 'kubernetes' AND clusterName=YOUR_CLUSTER_NAME

The events collected by New Relic will have the exact same attributes as given by Kubernetes. For a reference of these attributes please check the event v1 core reference in the official Kubernetes docs.

Search events in New Relic Infrastructure

To search events in the New Relic Infrastructure UI:

  1. Navigate to the Infrastructure event page: Go to infrastructure.newrelic.com > Events.
  2. In Category, select kubernetes.
  3. Use the search Search events field to look for specific events. To focus on a specific set of events, select or change the filter set.
View events in the Kubernetes cluster explorer

To view events in the Kubernetes cluster explorer:

  1. Access the Kubernetes cluster explorer using either of the two methods below:

  2. In the Kubernetes cluster explorer, select a pod to view the pod details.
  3. Select Show pod events.

Optional: Collect metrics for your events

If you would like to collect metric data for the events in your Kubernetes cluster, install the New Relic Prometheus OpenMetrics integration. To get started:

  1. Install the New Relic Prometheus OpenMetrics integration.
  2. Label the deployment of your Kubernetes events integration with your configured scrape label.
    • By default, this is: prometheus.io/scrape=true

Troubleshooting

Here are some troubleshooting tips when using the Kubernetes events integration.

Logs on event collection

To check the logs of our event collector:

kubectl logs deploy/nr-kube-events kube-events

To add more details, enable verbose mode by adding verbose: "true" in the config section of you configuration file, either before or after the clusterName.

Logs on sending events

To check the logs of the agent responsible for sending the events to New Relic:

kubectl logs deploy/nr-kube-events infra-agent

For more help

Other Kubernetes integration resources:

  • For discussions about the Kubernetes events integration, visit New Relic's Explorers Hub.
  • For integration version changes, see the release notes.