How to customize and reset the rke-metadata-config setting in Rancher
Article Number: 000020811
Environment
Rancher v2.x
Situation
Kontainer Driver Metadata (KDM) is a feature that enables Rancher to pull a list of the latest available Kubernetes versions for a Rancher minor release without requiring an upgrade of Rancher itself. By default, the metadata is pulled from a release-specific branch of the KDM GitHub repository, hosted at releases.rancher.com. In air-gapped environments, where Rancher is unable to connect to this URL, you may wish to host an internal mirror of this repository to use the feature.
This article details how to customize KDM synchronization via Rancher's rke-metadata-config setting, as well as how to reset it to the default.
Note: There is a separate KDM release branch for each minor release of Rancher, and the correct branch must be used for the running Rancher version. When running without a custom configuration, Rancher uses the default value in the rke-metadata-config setting, which includes the relevant branch for the current version. If you have set a value for the rke-metadata-config setting, the configuration will not be updated automatically. In that case, when upgrading Rancher, you should ensure that the release branch is updated in parallel (e.g. using the Helm values method documented below).
Resolution
Customizing the rke-metadata-config setting via the Rancher UI
To customize the rke-metadata-config setting via the Rancher UI, following the process outlined in the Rancher documentation.
Customizing the rke-metadata-config setting via Helm values
The rke-metadata-config can be configured via the Rancher environment variable CATTLE_RKE_METADATA_CONFIG.
In order to configure this environment variable on the Rancher Helm chart, follow the Rancher documentation for setting extra environment variables.
An example of the Helm values updating the rke-metadata-config URL to https://releases.example.com/kontainer-driver-metadata/release-v2.12/data.json is as follows:
--set 'extraEnv[0].name=CATTLE_RKE_METADATA_CONFIG'
--set 'extraEnv[0].value=\{\"refresh-interval-minutes\":\"1450"\,\"url"\:\"https://releases.example.com/kontainer-driver-metadata/release-v2.12/data.json\"}'
Resetting the rke-metadata-config setting to the default
As noted above, if you have set a value for the rke-metadata-config setting - even if that value matched the default at the time - the URL will no longer be updated automatically during Rancher upgrades.
If you would like to revert to the default rke-metadata-config behavior (pulling from releases.rancher.com with the URL automatically tracking your Rancher version), run the following command in the Rancher local cluster to remove the custom value:
kubectl patch setting.management.cattle.io rke-metadata-config --type='merge' -p '{"value":""}'