If you've recently made changes to your Rancher installation like updating the server URL or changing the Rancher installation SSL, then you will likely need to redeploy your cluster agent YAML files from the Rancher.
-
Create a local admin user for use with this tutorial. Without this, the script cannot login to get the new deployment file. You cannot use user accounts that are tied to third party authentication such as LDAP, Active Directory or GitHub to name a few.
-
Login to a single controlplane node of the cluster you need to redeploy your agent YAML to.
-
Download the script:
curl -LO https://github.com/patrick0057/cluster-agent-tool/raw/master/cluster-agent-tool.sh wget https://github.com/patrick0057/cluster-agent-tool/raw/master/cluster-agent-tool.sh
-
Run the script with the following options to redeploy your cluster YAML. -p is optional, if you don't include it, then the script will prompt you for the password so it doesn't have to be saved in your bash history.
bash cluster-agent-tool.sh -fy -a'save' -u'localadmin' -p'yourpassword'
-
If your script has made changes to multiple deployments and shows an output like the following, then you are good to repeat these steps for your next cluster.
namespace/cattle-system unchanged serviceaccount/cattle unchanged clusterrolebinding.rbac.authorization.k8s.io/cattle-admin-binding unchanged secret/cattle-credentials-bd8604b unchanged clusterrole.rbac.authorization.k8s.io/cattle-admin unchanged deployment.extensions/cattle-cluster-agent unchanged daemonset.extensions/cattle-node-agent unchanged Script has finished without error.