You can monitor your Kubernetes cluster using OpenTelemetry, which provides a standardized way to collect and send telemetry data to New Relic. This integration allows you to gain insights into your Kubernetes environment, including metrics, events, and logs.
New Relic recommends using the New Relic distribution of OpenTelemetry (NRDOT) for Kubernetes. This distribution is pre-configured to work seamlessly with New Relic and includes all necessary components and configurations to effectively monitor your Kubernetes cluster. However, if you prefer to use your own OpenTelemetry Collector, you can do so by ensuring it includes the required components for Kubernetes monitoring.
Requirements
To send Kubernetes telemetry data to New Relic, you need an OpenTelemetry Collector. Our NRDOT is configured to automatically monitor your Kubernetes cluster. It deploys all necessary components through our nr-k8s-otel-collector Helm chart.
If you opt for a different OpenTelemetry Collector, ensure it includes all the key components for comprehensive Kubernetes monitoring:
Our OpenTelemetry monitoring for Kubernetes provides robust support across various deployment environments. Supported platforms include:
Cloud vendors:
Amazon EKS
Microsoft AKS
Google GKE
Red Hat OpenShift
On-Premise clusters: We offer support for on-premise Kubernetes clusters.
Kubernetes versions: Support aligns with the Kubernetes versions currently supported by each vendor, ensuring compatibility and effective monitoring solutions across these environments.
重要
Windows nodes are not supported.
Install your Kubernetes cluster with OpenTelemetry
You can install OpenTelemetry for Kubernetes using one of the following methods:
The Helm installation method is the recommended approach for deploying OpenTelemetry on Kubernetes. This method simplifies the deployment process and allows for easy configuration management. You can use either the NRDOT or your own OpenTelemetry Collector.
New Relic recommends using the NRDOT for Kubernetes, which is pre-configured to work seamlessly with New Relic. This distribution includes all necessary components and configurations to effectively monitor your Kubernetes cluster. However, if you prefer to use your own OpenTelemetry Collector, you can do so by ensuring it includes the required components for Kubernetes monitoring.
You should see pods with names such as nr-k8s-otel-collector-<hash> in the newrelic namespace.
Verify that New Relic is receiving the necessary data, including metrics, events, and logs, by running the following queries. For more information, refer to Introduction to the query builder.
FROM Metric SELECT*WHERE k8s.cluster.name='<CLUSTER_NAME>'
FROM OtlpInfrastructureEvent SELECT*WHERE k8s.cluster.name='<CLUSTER_NAME>'
FROM Log SELECT*WHERE k8s.cluster.name='<CLUSTER_NAME>'
ヒント
If you want to use a different OpenTelemetry Collector to collect Kubernetes telemetry data, update the image settings in your values.yaml file to specify your desired OpenTelemetry Collector:
image:
repository: otel/opentelemetry-collector-contrib # Example: Using the contrib distro
tag:"latest"# Or a specific stable version like "0.98.0"
The Manifest installation method provides a way to set up OpenTelemetry for Kubernetes without using Helm. This method is suitable for users who prefer a more hands-on approach or have specific requirements that necessitate manual configuration.
To perform a manifest installation:
Copy the contents of the nr-k8s-otel-collector's rendered examples directory to your local workspace. This directory contains the Kubernetes manifest files.
Update the secret.yaml file in your local rendered directory. Replace <Your Base64 encoded License key> with your New Relic License Key, encoded in Base64.
data:
licenseKey: <Your Base64 encoded License key>
To Base64 encode your license key:
Linux/macOS: Use echo -n "YOUR_LICENSE_KEY" | base64.
Windows (PowerShell): Use [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("YOUR_LICENSE_KEY")).
Manually update your cluster name in both daemonset-configmap.yaml and deployment-configmap.yaml files within your local rendered directory. Locate instances of k8s.cluster.name and replace <cluster_name> with the desired name for your cluster.
-key: k8s.cluster.name
action: upsert
value: <cluster_name>
After updating these required fields, create the newrelic namespace and deploy the manifests to your cluster using kubectl.
bash
$
kubectl create namespace newrelic
$
kubectl apply -n newrelic -R-f rendered
ヒント
When deploying without Helm, components deployed via the rendered manifests might include a prefix, such as example-. This prefix is typically used in Helm chart templates for dynamic naming based on the Helm release name. If you prefer cleaner naming conventions, you can adjust these prefixes directly in the manifest files before applying them.
Configuration parameters in values.yaml
The values.yaml file in the nr-k8s-otel-collector Helm chart repository contains all the configuration parameters you can use to customize your OpenTelemetry Collector deployment. This file allows you to set various options, such as cluster name, license key, and other collector settings.
Parameter Name
Data Type
Description
Example Value
kube-state-metrics.enabled
Boolean
Specifies whether to install the kube-state-metrics Helm chart. This parameter is mandatory if infrastructure.enabled is set to true and you do not provide your own instance of Kube State Metrics (KSM) version 1.8 or later. KSM versions 2.0 and above disable labels and annotations metrics by default; you can enable these by using the metricLabelsAllowlist or metricAnnotationsAllowList options in your KSM configuration.
true
kube-state-metrics.prometheusScrape
Boolean
Disables Prometheus from automatically discovering KSM endpoints. This prevents potential duplication of scraped data if KSM is already being monitored by another Prometheus instance.
false
provider
String
Specifies the cloud vendor or environment where your Kubernetes cluster is deployed. This parameter sets known configuration constraints specific to your provider. Currently, supported values are "GKE_AUTOPILOT" for Google Kubernetes Engine Autopilot clusters and "OPEN_SHIFT" for Red Hat OpenShift.
"GKE_AUTOPILOT"
image.repository
String
Defines the Docker image repository for the OpenTelemetry Collector. You can specify your own collector image, provided it meets the necessary requirements for Kubernetes monitoring.
"newrelic/nrdot-collector-k8s"
image.pullPolicy
String
Determines the image pull policy. The default is IfNotPresent, which skips pulling an image if it already exists locally. If this parameter is defined without a specific value, it defaults to Always.
"IfNotPresent"
image.tag
String
Overrides the default image tag. By default, the tag is set to the chart's appVersion. Use this parameter to specify a particular version of the collector image.
"1.1.0"
cluster
String
Defines the name of the Kubernetes cluster being monitored. This is a mandatory parameter. You can also configure it using global.cluster.
"my-eks-cluster"
licenseKey
String
Specifies your New Relic License Key for authentication. This is a mandatory parameter. You can also configure it using global.licenseKey.
"NRAL-ABCDEFGHIJKLMN"
customSecretName
String
Specifies the name of a user-created Kubernetes Secret that holds the New Relic License Key. Use this option if you prefer not to include the license key directly in your values.yaml file. You can also configure it using global.customSecretName.
"my-nr-license-secret"
customSecretLicenseKey
String
Specifies the key within the Kubernetes Secret (defined by customSecretName) where the license key is located. Use this option when obtaining the license key from a Secret. You can also configure it using global.customSecretLicenseKey.
"licenseKey"
proxy
String
Configures the OpenTelemetry Collector instances (both Daemonset and Deployment) to send all telemetry data through the specified HTTP/HTTPS proxy.
"http://your-proxy.example.com:3128"
podLabels
Map (key-value)
Specifies additional labels to be added to all chart pods. These labels can be used for organizing and selecting Kubernetes resources.
{app.kubernetes.io/component: "otel-collector"}
labels
Map (key-value)
Specifies additional labels to be added to all Kubernetes objects created by the chart. These labels apply broadly to deployments, services, and other resources.
{environment: "production"}
priorityClassName
String
Sets the priorityClassName for all pods deployed by the chart. This controls the scheduling priority of the pods. You can also configure it using global.priorityClassName.
"system-cluster-critical"
dnsConfig
Map (key-value)
Sets the dnsConfig for all pods deployed by the chart. This allows for custom DNS settings for the pods. You can also configure it using global.dnsConfig.
{nameservers: ["8.8.8.8"]}
daemonset.nodeSelector
Map (key-value)
Sets the node selector for Daemonset pods, controlling which nodes they are scheduled on. This parameter overrides global node selectors.
{kubernetes.io/os: "linux"}
daemonset.tolerations
List
Specifies tolerations for Daemonset pods, allowing them to be scheduled on nodes with matching taints. This parameter overrides global tolerations.
Specifies additional annotations to be added to the Daemonset pods.
{prometheus.io/scrape: "true"}
daemonset.podSecurityContext
Map (key-value)
Sets the security context at the pod level for the Daemonset. This parameter overrides global pod security contexts.
{runAsUser: 1000}
daemonset.containerSecurityContext
Map (key-value)
Sets the security context at the container level for the Daemonset. This parameter overrides global container security contexts. This chart defaults to privileged: true for host monitoring capabilities.
{privileged: true}
daemonset.resources
Map (key-value)
Defines the compute resources (CPU and memory requests and limits) for the Daemonset containers.
Specifies additional environment variables to be set for the Daemonset containers.
[{name: "DEBUG_MODE", value: "true"}]
daemonset.envsFrom
List
Specifies additional environment variable sources for the Daemonset containers, typically from Secrets or ConfigMaps.
[{secretRef: {name: "my-daemonset-secret"}}]
daemonset.configMap.overrideConfig
Map (key-value)
Provides a complete OpenTelemetry configuration for the Daemonset. If set, this parameter overrides the default configuration and disables other configuration parameters specific to the Daemonset.
Specifies additional OpenTelemetry configuration for the Daemonset. If set, this parameter extends the default configuration by adding more receivers, processors, exporters, connectors, or pipelines.
receivers: {custom_receiver: {}}
deployment.nodeSelector
Map (key-value)
Sets the node selector for Deployment pods, controlling which nodes they are scheduled on. This parameter overrides global node selectors.
{kubernetes.io/hostname: "control-plane-node"}
deployment.tolerations
List
Specifies tolerations for Deployment pods, allowing them to be scheduled on nodes with matching taints. This parameter overrides global tolerations.
[{key: "CriticalAddonsOnly", operator: "Exists"}]
deployment.affinity
Map (key-value)
Configures affinities for Deployment pods, influencing their scheduling based on node or pod labels. This parameter overrides global affinities.
Specifies additional environment variables to be set for the Deployment containers.
[{name: "ENV_VAR", value: "some_value"}]
deployment.envsFrom
List
Specifies additional environment variable sources for the Deployment containers, typically from Secrets or ConfigMaps.
[{configMapRef: {name: "my-deployment-config"}}]
deployment.configMap.overrideConfig
Map (key-value)
Provides a complete OpenTelemetry configuration for the Deployment. If set, this parameter overrides the default configuration and disables other configuration parameters specific to the Deployment.
Specifies additional OpenTelemetry configuration for the Deployment. If set, this parameter extends the default configuration by adding more receivers, processors, exporters, connectors, or pipelines.
exporters: {log: {verbosity: "detailed"}}
nodeSelector
Map (key-value)
Sets the node selector for all pods deployed by the chart, affecting both Daemonset and Deployment. This parameter can also be configured using global.nodeSelector.
{disktype: "ssd"}
tolerations
List
Sets tolerations for all pods deployed by the chart, allowing them to be scheduled on nodes with matching taints. This parameter can also be configured using global.tolerations.
Configures affinities for all pods deployed by the chart, influencing their scheduling based on node or pod labels. This parameter can also be configured using global.affinity.
Sets the security context at the pod level for all pods deployed by the chart. This parameter can also be configured using global.securityContext.pod.
{runAsGroup: 3000}
containerSecurityContext
Map (key-value)
Sets the security context at the container level for all containers in pods deployed by the chart. This parameter can also be configured using global.securityContext.container.
{allowPrivilegeEscalation: false}
rbac.create
Boolean
Specifies whether Role-Based Access Control (RBAC) resources, such as Service Accounts, Roles, and RoleBindings, should be created by the Helm chart.
true or false
serviceAccount.create
Boolean
Specifies whether a Kubernetes ServiceAccount should be created for the collector pods. If set to true and serviceAccount.name is not specified, a name is generated using the full name template.
true or false
serviceAccount.name
String
Specifies a custom name for the ServiceAccount. If not set and serviceAccount.create is true, the chart generates a name.
"my-otel-sa"
serviceAccount.annotations
Map (key-value)
Specifies any additional annotations to add to the created ServiceAccount.
Enables debug-level logging for this integration. If set globally (using global.verboseLog), it enables debug logs for all integrations.
true or false
nrStaging
Boolean
Directs the collector to send all data to the New Relic staging backend. This option requires a valid staging license key. This parameter can also be configured using global.nrStaging.
true or false
receivers.prometheus.enabled
Boolean
Specifies whether the prometheus receiver is enabled for data collection.
true or false
receivers.prometheus.scrapeInterval
String
Sets the scrape interval for the prometheus receiver, determining how frequently metrics are collected.
1m
receivers.k8sEvents.enabled
Boolean
Specifies whether the k8sEvents receiver is enabled for collecting Kubernetes events.
true or false
receivers.hostmetrics.enabled
Boolean
Specifies whether the hostmetrics receiver is enabled for collecting host-level metrics.
true or false
receivers.hostmetrics.scrapeInterval
String
Sets the scrape interval for the hostmetrics receiver.
1m
receivers.kubeletstats.enabled
Boolean
Specifies whether the kubeletstats receiver is enabled for collecting metrics from the Kubelet.
true or false
receivers.kubeletstats.scrapeInterval
String
Sets the scrape interval for the kubeletstats receiver.
1m
receivers.filelog.enabled
Boolean
Specifies whether the filelog receiver is enabled for collecting logs from files, typically container logs.
true or false
lowDataMode
Boolean
Enables a mode that sends only the essential metrics required to illuminate the New Relic Kubernetes user interface. This helps reduce data ingestion volume.
true or false
Alerts
You can install essential alert policies by going through the guided installation flow in Integrations & Agents. This automatically sets up alert policy named Kubernetes (OpenTelemetry) alert policy in your New Relic account with multiple alert conditions designed for Kubernetes observability. Customize these conditions to suit your specific monitoring needs.
Find and use data
Check out these documents to learn more on how to find data: