How to change Rancher 2.x server-url

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

Situation

Task

Changing the server URL on Rancher 2.x.

Pre-requisites

Resolution

Single Server Installation

During this tutorial it is recommended to use the rancher-single-tool for Rancher single server installations. It isn't required but it makes the process much easier. As a result this guide will be based on using that tool.

  1. Download the rancher-single-tool to the node that is running your rancher server container.

    curl -LO https://github.com/rancherlabs/support-tools/raw/master/rancher-single-tool/rancher-single-tool.sh
    wget https://github.com/rancherlabs/support-tools/raw/master/rancher-single-tool/rancher-single-tool.sh
  2. Backup your Rancher installation.

    bash rancher-single-tool.sh -t'backup'
  3. Login to the Rancher web interface, navigate to the Global view by clicking the dropdown in the top left corner of the screen and selecting "Global". Then click "settings" in the middle of the top bar. From the settings page, change the server-url to match your new server url.

  4. Now we need to upgrade your Rancher container to reflect new certs. This is required in most cases with the exception of already using a wildcard that also encompasses the new server-url.

    a. To generate a new self signed certificate for your new URL use the following upgrade command. Follow the prompts to finish the upgrade.

    bash rancher-single-tool.sh -t'upgrade' -s'newhostname.company.com'

    b. To generate a new Let's Encrypt certificate you will need to change the Rancher server options to reflect this. You could do this with the following command.

    bash rancher-single-tool.sh -t'upgrade' -r'--acme-domain newhostname.company.com'

    c. If you were using certificates signed by a recognized CA before and just need to replace them, you should modify the docker options to reflect this change. Keep in mind that if you just replaced the cert files on the host path and the filenames didn't change, you can just restart the docker container. However if the filenames did change, I'm providing the example below of how you would do upgrade the container to see this change.

    bash rancher-single-tool.sh -t'upgrade' -d'-d -p 443:443 -p 80:80 --restart=unless-stopped --volume=/etc/rancherssl/certs/cert.pem:/etc/rancher/ssl/cert.pem --volume=/etc/rancherssl/certs/key.pem:/etc/rancher/ssl/key.pem'

    d. If you were using certificates signed by a private CA or you want to use your own self signed certifiactes (certificates not created by rancher-single-tool option -s). Below is an example of how you would do that. The same rule applies from option c. If the filenames have not changed you don't need to upgrade, you can just restart the container.

    bash rancher-single-tool.sh -t'upgrade' -d'-d -p 443:443 -p 80:80 --restart=unless-stopped --volume=/etc/rancherssl/certs/cert.pem:/etc/rancher/ssl/cert.pem --volume=/etc/rancherssl/certs/key.pem:/etc/rancher/ssl/key.pem --volume=/etc/rancherssl/certs/ca.pem:/etc/rancher/ssl/cacerts.pem'
  5. Once your Rancher container is backup and running you need to login to a single controlplane node for each of the downstream clusters and run the cluster-agent-tool. Please see https://github.com/rancherlabs/support-tools/tree/master/cluster-agent-tool

HA Installation
  1. Ensure that you have current etcd backups for your local rancher cluster.

  2. Login to the Rancher web interface, navigate to the Global view by clicking the dropdown in the top left corner of the screen and selecting "Global". Then click "settings" in the middle of the top bar. From the settings page, change the server-url to match your new server url.

  3. Log into a box where you have helm and kubectl installed. You will need your local Rancher cluster kubeconfig, ensure that it is set to the default config by either placing it in ~/.kube/config or by setting your KUBECONFIG environment variable.

  4. Check current helm chart options:

    helm get values rancher -n cattle-system
    hostname: rancher.company.com
    rancherImageTag: v2.3.5
  5. Craft an upgrade command based on the values provided in the previous step and then modify the hostname to match the new server hostname/url.

    helm upgrade rancher-stable/rancher --name rancher --namespace cattle-system --set hostname=newrancher.company.com --set rancherImageTag=v2.3.5
  6. Run the upgrade command then wait for rollout to complete.

    kubectl -n cattle-system  rollout status deploy/rancher
  7. Once your Rancher deployment is back up and running you need to login to a single controlplane node for each of the downstream clusters and run the cluster-agent-tool. You also need to login to one of the controlplane nodes of your local Rancher cluster and run the cluster-agent-tool. Please see https://github.com/rancherlabs/support-tools/tree/master/cluster-agent-tool

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:000020173
  • Creation Date: 13-Jul-2021
  • Modified Date:13-Jul-2021
    • SUSE Rancher

< Back to Support Search

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

SUSE Support Forums

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

Join Our Community

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.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

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

Go to Customer Center