{"id":23437831,"url":"https://github.com/onzack/update-rke-cluster","last_synced_at":"2026-05-04T10:39:08.333Z","repository":{"id":191141798,"uuid":"349012241","full_name":"onzack/update-rke-cluster","owner":"onzack","description":"Blueprint - Update Rancher Kubernetes Engine clusters built with Rancher","archived":false,"fork":false,"pushed_at":"2024-06-07T18:23:44.000Z","size":413,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T11:38:40.262Z","etag":null,"topics":["ansible","kubernetes","linux","rancher","ubuntu"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onzack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-18T09:25:29.000Z","updated_at":"2023-12-01T06:46:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"481cac7a-4941-4abb-af8f-2c24e82c605f","html_url":"https://github.com/onzack/update-rke-cluster","commit_stats":null,"previous_names":["onzack/update-rke-cluster"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onzack%2Fupdate-rke-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onzack%2Fupdate-rke-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onzack%2Fupdate-rke-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onzack%2Fupdate-rke-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onzack","download_url":"https://codeload.github.com/onzack/update-rke-cluster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248093904,"owners_count":21046762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","kubernetes","linux","rancher","ubuntu"],"created_at":"2024-12-23T14:38:24.439Z","updated_at":"2026-05-04T10:39:03.303Z","avatar_url":"https://github.com/onzack.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Update RKE cluster\nUpdate Rancher Kubernetes Engine (RKE) clusters built with Rancher.\n\n![Upadte RKE cluster visualization ](https://github.com/onzack/update-rke-cluster/blob/main/update-rke-cluster-blueprint.png)\n\n## Comments\nThe playbooks handles etcd and control plane nodes the same way.  \n\n## WARNING\nThe playbook uses an aggressive drain command for the nodes and the playbook will contunue even if the drain command was not successful. Updates are prioritized higher then pod availability.  \nThis early version of the playbook supports only Ubuntu or Debian as operating system.\n\n## Quick start\n### Prerequesites\n- Rancher Server and an RKE Cluster\n- Rancher information to update a downstream Kubernetes cluster\n  - Via Rancher API\n    - Kubernetes Cluster URL in Rancher is known, e. g. \"https://rancher.example.com/v3/clusters/c-asdf\"\n    - Cluster Name is known, e. g. \"apps-dev\"\n    - A Rancher API user, e. g. \"token-asdf\"\n    - The API user password/token\n  - Via `kubectl patch` command\n    - Cluster name is known, e. g. \"c-xdabc\"\n    - Kubeconfig file for the Rancher local cluster\n- Kubernets CLI (kubectl)\n- The kubeconfig file for the downstream cluster to drain and uncordon nodes\n\n### Run the playbooks\nUpdate all nodes and the kubernetes version (via API):  \n```\nexport PATH_TO_KUBECTL=$(which kubectl)\ngit clone https://github.com/onzack/update-rke-cluster.git\nansible-playbook -i hosts update-rke-cluster/ansible/update-rke-cluster.yml \\\n  -e kubernetes_cluster_url=\"https://rancher.example.com/v3/clusters/c-asdf\" \\\n  -e cluster_display_name=\"apps-dev\" \\\n  -e rancher_api_username=\"token-asdf\" \\\n  -e rancher_api_password=\"asdf321asdf321asdf321asdf321asdf321asdf321asdf321asdf3\" \\\n  -e path_to_kubectl=$PATH_TO_KUBECTL \\\n  -e kubeconfig_downstream=\"/home/ansible/kubeconfig_downstream\" \\\n  -e rancher_kubernetes_version=\"v1.23.10-rancher1-1\" \\\n  -e docker_package_name=\"docker.io\" \\\n  -e docker_version=\"20.10.12*\" \\\n  -e pause_seconds_between_workers=300\n```\n\nUpdate all nodes and the kubernetes version (via kubectl patch):  \n```\nexport PATH_TO_KUBECTL=$(which kubectl)\ngit clone https://github.com/onzack/update-rke-cluster.git\nansible-playbook -i hosts update-rke-cluster/ansible/update-rke-cluster.yml \\\n  -e cluster_name=\"c-asdf\" \\\n  -e kubeconfig_local=\"/home/ansible/kubeconfig_local\" \\\n  -e path_to_kubectl=$PATH_TO_KUBECTL \\\n  -e kubeconfig_downstream=\"/home/ansible/kubeconfig_downstream\" \\\n  -e rancher_kubernetes_version=\"v1.23.10-rancher1-1\" \\\n  -e docker_package_name=\"docker.io\" \\\n  -e docker_version=\"20.10.12*\" \\s\n  -e pause_seconds_between_workers=300\n```\n\nUpdate only the worker nodes:  \n```\nexport PATH_TO_KUBECTL=$(which kubectl)\ngit clone https://github.com/onzack/update-rke-cluster.git\nansible-playbook -i hosts update-rke-cluster/ansible/update-rke-cluster.yml \\\n  -e path_to_kubectl=$PATH_TO_KUBECTL \\\n  -e kubeconfig_downstream=\"/home/ansible/kubeconfig_downstream\" \\\n  -e pause_seconds_between_workers=300 \\\n  -e docker_package_name=\"docker.io\" \\\n  -e docker_version=\"20.10.12*\" \\\n  --tags \"worker\"\n```\n\nUpdate only the controlplane (master, etcd) nodes:  \n```\nexport PATH_TO_KUBECTL=$(which kubectl)\ngit clone https://github.com/onzack/update-rke-cluster.git\nansible-playbook -i hosts update-rke-cluster/ansible/update-rke-cluster.yml \\\n  -e path_to_kubectl=$PATH_TO_KUBECTL \\\n  -e kubeconfig_downstream=\"/home/ansible/kubeconfig_downstream\" \\\n  -e docker_package_name=\"docker.io\" \\\n  -e docker_version=\"20.10.12*\" \\\n  --tags \"controlplane\"\n```\n\nUpdate only the kubernetes version (via API):  \n```\nexport PATH_TO_KUBECTL=$(which kubectl)\ngit clone https://github.com/onzack/update-rke-cluster.git\nansible-playbook -i hosts update-rke-cluster/ansible/update-rke-cluster.yml \\\n  -e kubernetes_cluster_url=\"https://rancher.example.com/v3/clusters/c-asdf\" \\\n  -e cluster_display_name=\"apps-dev\" \\\n  -e rancher_api_username=\"token-asdf\" \\\n  -e rancher_api_password=\"asdf321asdf321asdf321asdf321asdf321asdf321asdf321asdf3\" \\\n  -e rancher_kubernetes_version=\"v1.23.10-rancher1-1\" \\\n  --tags \"kubernetes\"\n```\nUpdate only the kubernetes version (via kubectl patch):  \n```\nexport PATH_TO_KUBECTL=$(which kubectl)\ngit clone https://github.com/onzack/update-rke-cluster.git\nansible-playbook -i hosts update-rke-cluster/ansible/update-rke-cluster.yml \\\n  -e path_to_kubectl=$PATH_TO_KUBECTL \\\n  -e cluster_name=\"c-asdf\" \\\n  -e kubeconfig_local=\"/home/ansible/kubeconfig_local\" \\\n  -e rancher_kubernetes_version=\"v1.23.10-rancher1-1\" \\\n  --tags \"kubernetes\"\n```\n\n## How to get some of the needed information for the Ansible playbook\n### Ansible inventory file\nCreate a file with the following content and replace the hostnames and IPs with the values from your environment:\n```\nlocalhost ansible_connection=local\n\n[controlplane_nodes]\nmaster1 ansible_host=10.0.0.13\nmaster2 ansible_host=10.0.0.14\netcd1 ansible_host=10.0.0.10\netcd2 ansible_host=10.0.0.11\netcd3 ansible_host=10.0.0.12\n\n[worker_nodes]\nworker1 ansible_host=10.0.0.15\nworker2 ansible_host=10.0.0.16\nworker3 ansible_host=10.0.0.17\n```\n\n### The kubernetes_cluster_url\nIf you choose to update the Kubernetes cluster version via Rancher API, you need the corresponding URL for your cluster, e. g. \"https://rancher.example.com/v3/clusters/c-asdf\".  \nReplace \"rancher.example.com\" with the URL of your Rancher server and replace \"c-asdf\" with the \"metadata.name\" value of your cluster, as found in: Rancher Cluster Management menu -\u003e Cluster hamburger menu -\u003e \"View YAML\".\n\n### The rancher_api_username and rancher_api_password\nCreate a new personal API Key with scope \"No Scope\" and use the \"Access Key\" as the rancher_api_user and the \"Secret Key\" as the rancher_api_password.\n\n### The cluster_name\nGet the cluster name from the \"metadata.name\" value of your cluster, as found in: Rancher Cluster Management menu -\u003e Cluster hamburger menu -\u003e \"View YAML\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonzack%2Fupdate-rke-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonzack%2Fupdate-rke-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonzack%2Fupdate-rke-cluster/lists"}