Install the Kubernetes integration using Helm

Helm is a package manager on top of Kubernetes. It facilitates installation, upgrades, or revision tracking, and it manages dependencies for the services that you install in Kubernetes.

To install the integration using Helm, we recommend our Kubernetes automated installer, or follow the instructions in this document to complete a basic Kubernetes installation with Helm. To install the integration using manifests, see Kubernetes integration: install and configure.

To use Kubernetes integrations and infrastructure monitoring, as well as the rest of our observability platform, join the New Relic family! Sign up to create your free account in only a few seconds. Then ingest up to 100GB of data for free each month. Forever.

Compatibility and requirements

Our Helm chart is compatible with both Helm 2 and 3. Make sure Helm is installed on your machine.

To install the Kubernetes integration using Helm, you will need your New Relic account license key and your Kubernetes cluster's name:

  1. Find and copy your New Relic license key.
  2. Find the name of your cluster with this command:

    kubectl config current-context
  3. Make sure that kube-state-metrics is installed on your machine:

    kubectl get deployment --all-namespaces | grep kube-state-metrics

    If it's not installed, follow the instructions in the kube-state-metrics GitHub repo to install it.

Install Kubernetes integration with Helm

Follow the instructions for your version of Helm:

To install using Helm 3:

  1. Set the cluster where you want to install the agent:

    kubectl config set-cluster DESIRED_CLUSTER

    To see the available clusters, run kubectl config get-clusters.

  2. Add the New Relic Helm charts repo:

    helm repo add newrelic https://helm-charts.newrelic.com
  3. Make sure everything is configured properly in the chart by running the following command. (This step uses the --dry-run and --debug switches and therefore the agent is not installed.)

    helm install newrelic/newrelic-infrastructure \
        --dry-run \
        --debug \
        --set licenseKey=YOUR_NEW_RELIC_LICENSE_KEY \
        --set cluster=K8S_CLUSTER_NAME \
        --set config.custom_attributes.cluster=K8S_CLUSTER_NAME \
        --generate-name
  4. Install the Kubernetes integration:

    helm install newrelic/newrelic-infrastructure \
        --set licenseKey=yYOUR_NEW_RELIC_LICENSE_KEY \ 
        --set cluster=K8S_CLUSTER_NAME \ 
        --set config.custom_attributes.cluster=K8S_CLUSTER_NAME \
        --generate-name
  5. Wait a few seconds, then check that the DaemonSet and pods have been created:

    kubectl get daemonsets,pods
  6. Make sure you see a DaemonSet, and one pod per node.

To install using Helm 2:

  1. Set the cluster where you want to install the agent:

    kubectl config set-cluster DESIRED_CLUSTER

    To see the available clusters, run kubectl config get-clusters

  2. If your cluster uses role-based access, create a service account for tiller (Helm's service which runs inside the Kubernetes cluster) using a Kubernetes manifest file:

    1. Paste the following in a manifest file rbac-config.yaml:

      apiVersion: v1 
      kind: ServiceAccount 
      metadata: 
        name: tiller 
        namespace: kube-system 
      --- 
      apiVersion: rbac.authorization.k8s.io/v1 
      kind: ClusterRoleBinding 
      metadata: 
        name: tiller 
      roleRef: 
        apiGroup: rbac.authorization.k8s.io 
        kind: ClusterRole 
        name: cluster-admin 
      subjects: 
        - kind: ServiceAccount 
          name: tiller 
          namespace: kube-system
    2. Create the service account and role by running:

      kubectl create -f rbac-config.yaml
  3. Initialize Helm so that tiller is installed in the cluster:

    helm init --history-max 200
  4. Add the New Relic Helm charts repo:

    helm repo add newrelic https://helm-charts.newrelic.com
  5. Make sure everything is configured properly in the chart by running the following command. (This step uses the --dry-run and --debug switches and therefore the agent is not installed.)

    helm install newrelic/newrelic-infrastructure \
        --dry-run \
        --debug \
        --set licenseKey=YOUR_NEW_RELIC_LICENSE_KEY \
        --set cluster=K8S_CLUSTER_NAME \
        --set config.custom_attributes.cluster=K8S_CLUSTER_NAME 
    
  6. Install the New Relic Kubernetes integration:

    Note that the test switches have been removed.

        helm install newrelic/newrelic-infrastructure \
        --set licenseKey=your_new_relic_license_key \
        --set cluster=K8S_CLUSTER_NAME \
        --set config.custom_attributes.cluster=K8S_CLUSTER_NAME 
        
  7. Wait a few seconds, then check that the DaemonSet and pods have been created:

    kubectl get daemonsets,pods
  8. Make sure you see a DaemonSet, and one pod per node.

Helm configuration options

When you install or upgrade the Kubernetes integration with Helm using the command line, you can pass your configuration variables with the --set flag.

helm install newrelic/newrelic-infrastructure \
    --set licenseKey=YOUR_NEW_RELIC_LICENSE_KEY \
    --set cluster=YOUR_CLUSTER_NAME

Helm config parameters include:

Parameter Description
global.cluster - cluster

The cluster name for the Kubernetes cluster.

global.licenseKey - licenseKey

The license key for your New Relic account. This will be the preferred configuration option if you're using both licenseKey and customSecret.

global.customSecretName - customSecretName

The name of the Secret object where the license key is stored.

global.customSecretLicenseKey - customSecretLicenseKey

The key in the Secret object where the license key is stored.

config

A newrelic.yml file, if you're using one.

enableLinux

Deploys the DaemonSet on all your Linux nodes.

Default is true.

enableWindows

Deploys the DaemonSet on all your Windows nodes. For more information, see Running on Windows).

Default is false.

integrations_config

The list of integrations configured to monitor services running on Kubernetes. For more information, see Monitor services running on Kubernetes.

disableKubeStateMetrics

Disables kube-state-metrics data parsing if the value is true.

Default is false.

kubeStateMetricsUrl

If provided, the discovery process for the kube-state-metrics endpoint won't be triggered. For example: http://172.17.0.3:8080.

kubeStateMetricsPodLabel

If provided, we'll use this label to discover the kube-state-metrics pod. Set this to true on the target pod.

kubeStateMetricsTimeout

The timeout for accessing kube-state-metrics in milliseconds. If it's not set, the default is 5000.

kubeStateMetricsScheme

If kubeStateMetricsPodLabel is present, it changes the scheme used to send a request to the pod.

Default is http.

kubeStateMetricsPort

If kubeStateMetricsPodLabel is present, it changes the port queried in the pod.

Default is 8080.

rbac.create

Enable role-based authentication./

Default is true.

rbac.pspEnabled

Enable pod security policy support.

Default is false.

privileged

Enable privileged mode.

Default is true.

image.repository

The container to pull.

Default is newrelic/infrastructure-k8s.

image.pullPolicy

The pull policy.

Default is IfNotPresent.

image.pullSecrets

The image pull secrets.

Default is nil.

image.tag

The version of the container to pull.

Default is 1.26.5.

image.windowsTag

The version of the Windows container to pull.

Default is 1.21.0-windows-1809-alpha.

resources

Any resources you want to assign to the pod. For more information, see the resources documentation on GitHub.

verboseLog

Should the agent use a verbose log? (Boolean).

Default is false.

priorityClassName

The scheduling priority of the pod.

Default is nil.

nodeSelector

The node label to use for scheduling.

Default is nil.

windowsNodeSelector

The Node label to use for scheduling on Windows nodes.

Default is { kubernetes.io/os: windows }.

tolerations

The list of node taints to tolerate (requires Kubernetes >= 1.6). For more information, see the tolerations documentation on GitHub.

updateStrategy

The strategy for DaemonSet updates (requires Kubernetes >= 1.6).

Default is RollingUpdate.

serviveAccount.create

If true, a service account is created and assigned to the deployment.

Default is true.

serviveAccount.name

The service account to assign to the deployment. If serviveAccount.create is true, then this name will be used when creating the service account.

serviveAccount.annotations

The annotations to add to the service account if serviveAccount.create is set to true.

etcdTlsSecretName

The name of the secret containing the cacert, cert, and key used for setting the mTLS config for retrieving metrics from ETCD.

etcdTlsSecretNamespace

The namespace where the secret specified in etcdTlsSecretName was created.

Default is default.

etcdEndpointUrl

Explicitly sets the etcd component URL.

apiServerSecurePort

Set to query the API server over a secure port.

apiServerEndpointUrl

Explicitly sets the API server component URL.

schedulerEndpointUrl

Explicitly sets the scheduler component URL.

controllerManagerEndpointUrl

Explicitly sets the controller manager component URL.

eventQueueDepth

Increases the in-memory cache of the agent to accommodate for more samples at a time.

enableProcessMetrics

Enables the sending of process metrics to New Relic. Default is false.

global.nrStaging - nrStaging

Send data to staging (requires a staging license key).

Default is false.

discoveryCacheTTL

Duration since the discovered endpoints are stored in the cache until they expire. Valid time units: ns, us, ms, s, m, h.

Default is 1h.

Update via Helm

To update your Kubernetes integration installed via Helm:

  1. Update the local chart repository:

    helm repo update
  2. Get the release name of the newrelic-infrastructure chart:

    helm list
  3. Update the release:

    helm upgrade RELEASE_NAME newrelic/newrelic-infrastructure \ 
        --set licenseKey=YOUR_NEW_RELIC_LICENSE_KEY \ 
        --set cluster=K8S_CLUSTER_NAME \         
        --set config.custom_attributes.cluster=K8S_CLUSTER_NAME
    

For more help

If you need more help, check out these support and learning resources: