SUSE Support

Here When You Need Us

Rancher upgrades fails with "resource mapping not found for name" error due to deprecated api version for a resource

This document (000021213) is provided subject to the disclaimer at the end of this document.

Situation

Rancher upgrade is failing due to the deprecated api version of a resource.

The relevant error message below may appear when running the helm upgrade command to upgrade Rancher.

Examples:
helm upgrade rancher rancher-stable/rancher --namespace cattle-system  -f values.yaml --version=2.X.X
Error: UPGRADE FAILED: unable to build kubernetes objects from current release manifest: resource mapping not found for name: "rancher" namespace: "" from "": no matches for kind "Issuer" in version "cert-manager.io/v1alpha2"" ensure CRDs are installed first
helm upgrade rancher rancher-stable/rancher --namespace cattle-system -f values.yaml   --version=2.X.X
Error: UPGRADE FAILED: unable to build kubernetes objects from current release manifest: resource mapping not found for name: "rancher" namespace: "" from "": no matches for kind "Ingress" in version "networking.k8s.io/v1beta1"

 

Resolution

The helm-mapkubeapis plugin can be used to restore your release to a working state. This plugin reads Helm release data and replaces superseded APIs with their new versions or removes resources that refer to APIs that were completely removed from Kubernetes. 

Note that Helm plugins are installed locally in the machine where the commands are run. Therefore, please make sure to run the installation steps on the same machine where you intend to run the cleanup steps. 

 

Install helm-mapkubeapis
 

  1. Ensure that Helm is installed by running `helm version`

    You should see an output similar to the following: 

    version.BuildInfo{Version:"v3.10.2", GitCommit:"50f003e5ee8704ec937a756c646870227d7c8b58", GitTreeState:"clean", GoVersion:"go1.18.8"} 
    
     
  1. Install the helm-mapkubeapis plugin:

    helm plugin install https://github.com/helm/helm-mapkubeapis  

    Output should be similar to: 

    Downloading and installing helm-mapkubeapis v0.4.1 ...
    https://github.com/helm/helm-mapkubeapis/releases/download/v0.4.1/helm-mapkubeapis_0.4.1_linux_amd64.tar.gz
    Installed plugin: mapkubeapis
    
    
Make sure that the installed version of helm-mapkubeapis is v0.4.1 or later, as earlier versions do not support the removal of resources. 
 
  1. Check that the plugin was installed correctly:

    helm mapkubeapis --help  

    Output should be similar to: 

    Map release deprecated or removed Kubernetes APIs in-place  
    Usage: 
        mapkubeapis [flags] RELEASE 
         
    Flags: 
        --dry-run               simulate a command 
        -h, --help              help for mapkubeapis 
        --kube-context string   name of the kubeconfig context to use 
        --kubeconfig string     path to the kubeconfig file 
        --mapfile string        path to the API mapping file 
        --namespace string      namespace scope of the release
    
     

Clean up releases
 

  1. Open your terminal of choice and make sure the Rancher management upstream cluster is accessible by running:

    kubectl cluster-info
    
  2. Perform a dry run for the Rancher release in the cattle-system namespace to check the changes:
    helm mapkubeapis --dry-run rancher  --namespace cattle-system

    Output should be similar to:

    NOTE: This is in dry-run mode, the following actions will not be executed.
    Run without --dry-run to take the actions described below:
    Release 'rancher' will be checked for deprecated or removed Kubernetes APIs and will be updated if necessary to supported API versions.
    Get release 'rancher' latest version.
    Check release 'rancher' for deprecated or removed APIs...
    Found 1 instances of deprecated or removed Kubernetes API:
    "apiVersion: networking.k8s.io/v1beta1
    kind: Ingress
    NOTE: This is in dry-run mode, the following actions will not be executed.
    Run without --dry-run to take the actions described below:
    Release 'rancher' will be checked for deprecated or removed Kubernetes APIs and will be updated if necessary to supported API versions.
    Get release 'rancher' latest version.
    Check release 'rancher' for deprecated or removed APIs...
    Found 1 instances of deprecated or removed Kubernetes API:
    "apiVersion: networking.k8s.io/v1beta1
    kind: Ingress
    
  3. Perform a full run with helm:
    helm mapkubeapis rancher --namespace cattle-system
    
    Output should be similar to:
         Release 'rancher' will be checked for deprecated or removed Kubernetes APIs and will be updated if necessary to supported API versions.
    Get release 'rancher' latest version.
    Check release 'rancher' for deprecated or removed APIs...
    Found 1 instances of deprecated or removed Kubernetes API:
    "apiVersion: networking.k8s.io/v1beta1
    kind: Ingress
    "
    Supported API equivalent:
    "apiVersion: networking.k8s.io/v1
    kind: Ingress
    "
    Finished checking release 'rancher' for deprecated or removed APIs.
    Deprecated or removed APIs exist, updating release: rancher.
    Set status of release version 'rancher.v1' to 'superseded'.
    Release version 'rancher.v1' updated successfully.
    Add release version 'rancher.v2' with updated supported APIs.
    Release version 'rancher.v2' added successfully.
    Release 'rancher' with deprecated or removed APIs updated successfully to new version.
    Map of release 'rancher' deprecated or removed APIs to supported versions, completed successfully.
    Re-run the helm upgrade command after all deprecated or superseded APIs are removed.

Additional Information

How to check apiVersions for a release
Command to get the available apiVersion for cert-manager
kubectl get --raw /apis/cert-manager.io | jq .
 

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000021213
  • Creation Date: 25-Sep-2023
  • Modified Date:01-Mar-2024
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.