Upgrading the Kubernetes integration

After a new version of Kubernetes has been released, you can upgrade the Kubernetes version running on control plane nodes and worker nodes in a cluster.

Upgrading our Kubernetes integration

Our Kubernetes integration is under active development and we regularly release updates which include bug fixes, new features, and support for newer Kubernetes versions and cloud providers. We strongly recommend all our customers to regularly update the Kubernetes integration to get the best experience.

Upgrading using the guided install and Helm

In order to update an installation that was deployed using Helm command provided by the guided install, just go through the process and run the Helm command again. This will pull the new version of the chart and its dependencies and upgrade it to the latest version.

If you want to manually upgrade your Kubernetes integration installed via Helm:

  1. Update the local chart repository:

    bash
    $
    helm repo update
  2. Update the release by running again the appropriate helm upgrade --install ... command in the section above:

    bash
    $
    helm upgrade --install newrelic newrelic/nri-bundle \
    >
    --namespace newrelic --create-namespace \
    >
    -f values-newrelic.yaml

Upgrading using the guided install and plain manifests

Tip

We encourage you to deploy our integration using Helm, as it provides a cleaner upgrade path compared to using manifests directly.

If custom manifests have been used instead of Helm, you'll need to first remove the old installation using kubectl delete -f previous-manifest-file.yml, and then proceed through the guided install again. This will generate an updated set of manifests that you can deploy using kubectl apply -f manifest-file.yml.

We don't recommend applying a new version of the manifest file without removing the previous one first, since it might leave some leftover components in your cluster.

If you need an advanced way to create your manifest, template it using Helm.

Upgrading the nri-bundle version

Changed label selectors

When upgrading to the new version of KSM, you might see an error like this:

v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"newrelic", "app.kubernetes.io/name":"kube-state-metrics"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

The label selector in the new version of the chart changed, but the name of the deployment did not. Therefore, in order to upgrade you need to remove the kube-state-metrics deployment before running helm upgrade, or to fully uninstall and then reinstall the integration.

Deprecated values

On the other hand, you might see the following log when upgrading:

warning: skipped value for nri-bundle.kube-state-metrics.collectors: Not a table.
Error: UPGRADE FAILED: template: nri-bundle/charts/kube-state-metrics/templates/role.yaml:18:6: executing "nri-bundle/charts/kube-state-metrics/templates/role.yaml" at <has "certificatesigningrequests" $.Values.collectors>: error calling has: Cannot find has on type map

This is because the KSM chart values changed and the map of collectors has been changed to a list of collectors. The collector list is not needed anymore, and it has been removed from the new values.

If you still have those in your static Helm values, or if you are using the flag --reuse-values you should first remove the following values:

kube-state-metrics:
collectors:
certificatesigningrequests: true
ingresses: false

Unsupported Kubernetes resources

When upgrading the newrelic-bundle, you might see an error about a certain resource not being supported by a specific Kubernetes API. For example,

Error: UPGRADE FAILED: unable to build kubernetes objects from current release manifest: resource mapping not found for name: "newrelic-bundle-nri-metadata-injection" namespace: "" from "": no matches for kind "MutatingWebhookConfiguration" in version "admissionregistration.k8s.io/v1beta1"

That means the corresponding Kubernetes resource is not supported by the corresponding Kubernetes API. You can follow the instructions on Helm mapkubeapis Plugin to solve the error.