Install the Kubernetes integration using Helm

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

To install the integration using Helm, we recommend our Kubernetes automated installer, or you can complete the manual steps that follow.

To install the integration using manifests, see Kubernetes integration: install and configure.

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 you want to install the agent in:
    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. Ensure the DaemonSet and pods have been created:
    kubectl get daemonsets,pods

    You may need to wait for a few seconds.

Make sure you see a DaemonSet, and one pod per node.

To install using Helm 2:

  1. Set the cluster you want to install the agent in:
    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 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. Ensure the DaemonSet and pods have been created:
    kubectl get daemonsets,pods

    You may need to wait for a few seconds.

    Make sure you see a DaemonSet, and one pod per node.

Update via Helm

To update your Kubernetes integration installed via Helm, follow these steps:

  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: