Install the Kubernetes integration

New Relic's Kubernetes integration gives you full observability into the health and performance of your infrastructure. With this agent you can collect telemetry data from your cluster using several New Relic integrations such as the Kubernetes events integration, the Prometheus agent, the nri-kubernetes, and the New Relic Logs Kubernetes plugin.

Screenshot showing the Overview dashboard

Go to one.newrelic.com > All capabilities > Kubernetes. Select your cluster and click Overview Dashboard in the left navigation pane. See Explore your Kubernetes cluster for more info.

Important

If you're going to install the New Relic Kubernetes integration on Windows or EKS Fargate, see the Install Kubernetes on Windows and Install Kubernetes on AWS EKS Fargate documents.

Follow these steps to install the New Relic Kubernetes integration.

Before you begin

  • You need a New Relic . You can set up a free account, no credit card required.

  • Be sure you're using a supported Kubernetes version and distribution, check out the compatibility and requirements page. You'll also find specific requirements for Helm and Manifest.

Specific requirements

Depending on where you store your clusters, there are different integration specifications:

Choose your instrumentation method

Install the Kubernetes integration

You can manually install Kubernetes integration from a simple manifest with pre-populated required values.

  1. Create a file named yaml file, for example newrelic-manifest.yaml. Include the configuration you need. The file must follow this structure:

    global:
    licenseKey: _YOUR_NEW_RELIC_LICENSE_KEY_
    cluster: _K8S_CLUSTER_NAME_
    namespace: newrelic
    newrelic-infrastructure.privileged:
    enabled: false
    global.lowDataMode:
    enabled: true
    kube-state-metrics.image.tag:
    "'${KSM_IMAGE_VERSION}'"
    kube-state-metrics:
    # Deploy kube-state-metrics in the cluster.
    # Set this to true unless it is already deployed.
    enabled: true
    kubeEvents:
    # Report Kubernetes events
    enabled: true
    newrelic-prometheus-agent:
    # Automatically scrape prometheus metrics for annotated services in the cluster
    enabled: true
    newrelic-prometheus-agent.lowDataMode:
    enabled: true
    newrelic-prometheus-agent.config.kubernetes.integrations_filter:
    enabled: false
    logging.enabled:
    enabled: true
    newrelic-logging.lowDataMode:
    # Report logs for containers running in the cluster
    enabled: true
    newrelic-logging.fluentBit.linuxMountPath:
    /var/log
    storageClass:
    enabled: standard-rwx
  2. Run this command to apply the manifest generated:

    bash
    $
    kubectl -n newrelic apply -f newrelic-manifest.yaml
  3. If you're going to use a GKE AutoPilot cluster, your Helm command should include the following:

    --set newrelic-infrastructure.controlPlane.enabled=false \
    --set newrelic-infrastructure.kubelet.config.scheme=http \
    --set newrelic-infrastructure.kubelet.config.port=10255 \

    Fluent Bit can use a FileStore volume to prevent data loss or duplicated logs during Fluent Bit pod restarts or redeploys. Google FileStore API needs to be enabled in your GKE project. Check this document to know more about enabling APIs.

    To use FileStore, add the following:

    --set newrelic-logging.fluentBit.persistence.mode=persistentVolume
    --set newrelic-logging.fluentBit.persistence.persistentVolume.storageClass=standard-rwx

    Important

    The use of FileStore will result in additional costs, as charged by Google. See your Google Cloud Admin or the FileStore doc for more info.

    If you don't want to use FileStore:

    • Set "newrelic-logging.fluentBit.persistence.mode" to "none"
    • Remove "newrelic-logging.fluentBit.persistence.persistentVolume.storageClass"
  4. Decide if you want to install and configure the Prometheus endpoints to scrape. We recommend to scrape all Prometheus endpoints except core Kubernetes system metrics. Kubernetes integration already collects core Kubernetes system metrics in other components. See Install and configure the Prometheus agent on Kubernetes clusters for more info.

  5. Gather Log data. You can:

    • Forward all logs with full enrichment. Full enrichment ensures that all Kubernetes metadata, including labels and annotations, are associated with each log record. See Fluent Bit documentation for more info.

    • Forward all logs with minimal enrichment (low data mode). See New Relic Logging for more info.

    We recommend you forward all logs with minimal enrichment. This is a low-data mode that excludes labels excludes labels and annotations from log records, but keeps a minimal set of Kubernetes metadata. This set includes cluster_name, container_name, namespace_name, and pod_name.

You should see the following:

  • newrelic-nrk8s-ksm pod.
  • newrelic-nrk8s-kubelet pod for each node in your cluster.
  • newrelic-nrk8s-control-plane pod for each master node in your cluster, if any.
  • newrelic-kube-state-metrics pod, if you included KSM with our installation.
  • newrelic-nri-kube-events pod, if you enabled Kubernetes events reporting.
  • prometheus-agent pod, if you enabled the Prometheus agent integration.
  • newrelic-newrelic-logging pod for each node in your cluster, if you enabled the logging integration.

Find and use data

Once you've finished all the steps, you can test the connection to make sure everything is working properly and view your data.

Testing Kubernetes installation

Tip

Not seeing data? If you completed the steps and are still not seeing data, check out this troubleshooting page.

After the installation, you should see the following in the UI:

  • newrelic-nrk8s-ksm pod.
  • newrelic-nrk8s-kubelet pod for each node in your cluster.
  • newrelic-nrk8s-control-plane pod for each master node in your cluster, if any.
  • newrelic-kube-state-metrics pod, if you included KSM with our installation.
  • newrelic-nri-kube-events pod, if you enabled Kubernetes events reporting.
  • prometheus-agent pod, if you enabled the Prometheus agent integration.
  • newrelic-newrelic-logging pod for each node in your cluster, if you enabled the logging integration.

After deploying this integration, you can add:

  • A default set of recommended alerts conditions and dashboards that you can add to your account. These conditions are grouped into these policies:

    • Kubernetes: To add the default set of recommended alert conditions and a dashboard.
    • Google Kubernetes Engine: To add the default set of recommended Google Kubernetes engine alert conditions and a dashboard.

    Once added, you can customize the alert conditions to meet your needs. See Recommended alert policies for more information about managing them.

  • Pre-built dasboards. Follow these steps to add pre-defined dashboards:

    1. Go to one.newrelic.com > Integrations & Agents.

    2. Select Dashboards to access the pre-built resources.

    3. Search Kubernetes and select the dashboard you want to add.

      Add Kubernetes dashboards
    4. Click Edit if you want to change the account in the popup window that opens.

    5. Click Setup Kubernetes or Skip this step if you already setup this integration.

    6. Click View dashboard, and see your Kubernetes data in New Relic.

    For more on creating dasboards, see our Create custom data visualizations with dashboards doc.