rancher: [BUG] Restoring Rancher to a previously installed version of Rancher causes Rancher to become inaccessible

Rancher Server Setup

  • Rancher version: v2.12.0-alpha17
  • Installation option (Docker install/Helm Chart): Helm
    • If Helm Chart, Kubernetes Cluster and version (RKE1, RKE2, k3s, EKS, etc): RKE2
  • Proxy/Cert Details:

Information about the Cluster

  • Kubernetes version: v1.32.5+rke2r1
  • Cluster Type (Local/Downstream): Local
    • If downstream, what type of cluster? (Custom/Imported or specify provider for Hosted/Infrastructure Provider):

User Information

  • What is the role of the user logged in? (Admin/Cluster Owner/Cluster Member/Project Owner/Project Member/Custom) Admin
    • If custom, define the set of permissions:

Describe the bug

When attempting to restore a Rancher backup from an upgraded Rancher, I am unable to access Rancher. Specifically, the rancher deployment witnesses the following behavior in the Event Logs:

Events:
  Type    Reason             Age                  From                   Message
  ----    ------             ----                 ----                   -------
  Normal  ScalingReplicaSet  25m                  deployment-controller  Scaled up replica set rancher-6b4589889b from 0 to 3
  Normal  ScalingReplicaSet  9m41s                deployment-controller  Scaled up replica set rancher-c7f457747 from 0 to 1
  Normal  ScalingReplicaSet  9m41s                deployment-controller  Scaled down replica set rancher-6b4589889b from 3 to 2
  Normal  ScalingReplicaSet  9m41s                deployment-controller  Scaled up replica set rancher-c7f457747 from 1 to 2
  Normal  ScalingReplicaSet  9m                   deployment-controller  Scaled down replica set rancher-6b4589889b from 2 to 1
  Normal  ScalingReplicaSet  9m                   deployment-controller  Scaled up replica set rancher-c7f457747 from 2 to 3
  Normal  ScalingReplicaSet  8m30s                deployment-controller  Scaled down replica set rancher-6b4589889b from 1 to 0
  Normal  ScalingReplicaSet  36s (x7 over 5m45s)  deployment-controller  Scaled down replica set rancher-c7f457747 from 3 to 0
  Normal  ScalingReplicaSet  36s (x6 over 4m55s)  deployment-controller  Scaled up replica set rancher-c7f457747 from 0 to 3

I would expect the replica sets to go down, but then to eventually come back up and Rancher is accessible and with the restore being successful.

To Reproduce

  1. Setup Rancher v2.11.3.
  2. Provision downstream clusters (I provisioned RKE2/K3s node driver with v1.32.5).
  3. Install the Rancher backup chart on the local cluster.
  4. Create a backup in the Rancher UI.
  5. Upgrade Rancher to v2.12.0-alpha17 (reproduced on head as well)
  6. Attempt to restore the backup in the Rancher UI; note that Rancher is inacessible.

To get around this, I had to kubectl delete restore <restore name>. Then, I was back at v2.12.0-alpha17 with my downstream clusters back in an Active state.

Result Restore does not work and Rancher is inaccessible.

Expected Result

Restore should work and Rancher should be accessible.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

@jbiers I see, thanks for that! I will test again soon and see if all is well in that case.

I don’t think BRO should be backing up these resources @mallardduck. The builtin global roles are created every time on start up and aren’t allowed to be modified by users. I don’t see any reason they should be saved. I’m not sure if there’s a recent change that caused this to occur, but I think it would be safe to ignore any GlobalRole or RoleTemplate with the field builtin: true

It could be a bug in Rancher v2.12 related to BRO:

Some built-in global roles were modified in v2.12 - one of such PRs: https://github.com/rancher/rancher/pull/49075

Rancher-webhook is designed to reject any changes to built-in global roles, except for changes to the newUserDefault field. (code)

In a backup restore scenario, if the current cluster already has the updated v2.12 versions of these global roles, but the backup file contains older versions (with different field values), Rancher-webhook will block the restore operation due to the differences.

List of rejected global roles from the BRO logs:

project-owner
clustertemplaterevisions-create
clustertemplates-create
user-base
clusters-create
user

Error message in BRO logs:

172317-ERRO[2025/07/01 19:59:52] Error restoring cluster-scoped resources [error restoring user-base of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplates-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles error restoring project-owner of type management.cattle.io/v3, Resource=roletemplates: restoreResource: err updating resource admission webhook "rancher.cattle.io.roletemplates.management.cattle.io" denied the request: roletemplate: Forbidden: updates to builtIn RoleTemplates for fields other than CreatorDefault are forbidden error restoring clusters-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring user of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplaterevisions-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles]
344351-ERRO[2025/07/01 20:00:45] Error restoring cluster-scoped resources [error restoring clustertemplates-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles error restoring project-owner of type management.cattle.io/v3, Resource=roletemplates: restoreResource: err updating resource admission webhook "rancher.cattle.io.roletemplates.management.cattle.io" denied the request: roletemplate: Forbidden: updates to builtIn RoleTemplates for fields other than CreatorDefault are forbidden error restoring user-base of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clusters-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplaterevisions-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles error restoring user of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden]
516549-ERRO[2025/07/01 20:01:35] Error restoring cluster-scoped resources [error restoring project-owner of type management.cattle.io/v3, Resource=roletemplates: restoreResource: err updating resource admission webhook "rancher.cattle.io.roletemplates.management.cattle.io" denied the request: roletemplate: Forbidden: updates to builtIn RoleTemplates for fields other than CreatorDefault are forbidden error restoring user-base of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clusters-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring user of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplates-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles error restoring clustertemplaterevisions-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles]
688747-ERRO[2025/07/01 20:02:28] Error restoring cluster-scoped resources [error restoring clustertemplates-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles error restoring user-base of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring project-owner of type management.cattle.io/v3, Resource=roletemplates: restoreResource: err updating resource admission webhook "rancher.cattle.io.roletemplates.management.cattle.io" denied the request: roletemplate: Forbidden: updates to builtIn RoleTemplates for fields other than CreatorDefault are forbidden error restoring clusters-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring user of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplaterevisions-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles]
860945-ERRO[2025/07/01 20:03:20] Error restoring cluster-scoped resources [error restoring clusters-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring project-owner of type management.cattle.io/v3, Resource=roletemplates: restoreResource: err updating resource admission webhook "rancher.cattle.io.roletemplates.management.cattle.io" denied the request: roletemplate: Forbidden: updates to builtIn RoleTemplates for fields other than CreatorDefault are forbidden error restoring user of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplaterevisions-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles error restoring user-base of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplates-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles]
1033143-ERRO[2025/07/01 20:04:11] Error restoring cluster-scoped resources [error restoring clusters-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring user-base of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplates-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles error restoring user of type management.cattle.io/v3, Resource=globalroles: restoreResource: err updating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: updates to builtIn GlobalRoles for fields other than 'newUserDefault' are forbidden error restoring clustertemplaterevisions-create of type management.cattle.io/v3, Resource=globalroles: restoreResource: err creating resource admission webhook "rancher.cattle.io.globalroles.management.cattle.io" denied the request: globalrole: Forbidden: cannot create builtin GlobalRoles error restoring project-owner of type management.cattle.io/v3, Resource=roletemplates: restoreResource: err updating resource admission webhook "rancher.cattle.io.roletemplates.management.cattle.io" denied the request: roletemplate: Forbidden: updates to builtIn RoleTemplates for fields other than CreatorDefault are forbidden]

@markusewalker I actually think this is expected behavior. BRO doesn’t track the Rancher deployment and doesn’t include it in backups by design, so a Restore doesn’t really change Rancher version.

In the Rancher rollback documentation we see that after performing a Restore, you actually have to run helm rollback rancher -n cattle-system to get Rancher to the previous version, because of the way BRO is designed.

@jbiers that is correct, the prune option was set to true when I tried the full resourceset. I tried again to double-check and it was set to true, but same result.

@markusewalker the fix can now be found in the latest version of the rancher-backup chart 107.0.0+up8.0.0-rc.7

Retested on head https://github.com/rancher/rancher/commit/cba4929a3943a8d25749abb25e66479f25eb35ee and using the rancher-backup chart version 107.0.0+up8.0.0-rc.6. Please see below the test scenarios considered:

# Scenario Result
1 Restore Rancher to a prior released version ✅
2 Restore Rancher to the previously released version of Rancher ❌

In failing scenario 2, here was my workflow:

  1. Setup Rancher v2.11.3.
  2. Provision downstream clusters.
  3. Install backup and restore chart (the new 107.0.0+up8.0.0-rc.6).
  4. Upgrade Rancher (upgraded to head and even tried with v2.12.0-alpha17).
  5. Restore Rancher to v2.11.3.

Upon doing that, I still get the same issue as reported. Initially, I thought this failure was due to my using the incorrect chart version. But even upon using the updated chart, I still hit this issue. So as of now, I still would consider this issue blocked.

good catch @markusewalker - i did the GitHub sin of saying that PR fixed this issue so it closed on my behalf lol. BTW the charts PR is in flight, so once merged QA should be able to test with the new version of BRO.