mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-05-23 21:34:34 +03:00
docs: fix incorrect Ansible paths and standardize inventory references (#13246)
This commit updates documentation across several files to correct broken file paths and ensure consistency in Ansible command examples - Standardized inventory naming to `inventory.ini` for sample inventories. - Fixed `group_vars` paths to reflect the actual directory structure (e.g., `group_vars/all/all.yml` instead of `group_vars/all.yml`). - Corrected the `k8s-cluster.yml` filename in guides. - Clarified the location for `kubectl_localhost` and `kubeconfig_localhost` settings. - Replaced non-existent placeholders (like `inventory/single.cfg`) with valid repository paths. - Fixed typos in directory names (e.g., `myclsuter` -> `mycluster`).
This commit is contained in:
+29
-29
@@ -26,13 +26,13 @@ If you wanted to upgrade just kube_version from v1.18.10 to v1.19.7, you could
|
||||
deploy the following way:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook cluster.yml -i inventory/sample/hosts.ini -e kube_version=1.18.10 -e upgrade_cluster_setup=true
|
||||
ansible-playbook cluster.yml -i inventory/sample/inventory.ini -e kube_version=1.18.10 -e upgrade_cluster_setup=true
|
||||
```
|
||||
|
||||
And then repeat with 1.19.7 as kube_version:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook cluster.yml -i inventory/sample/hosts.ini -e kube_version=1.19.7 -e upgrade_cluster_setup=true
|
||||
ansible-playbook cluster.yml -i inventory/sample/inventory.ini -e kube_version=1.19.7 -e upgrade_cluster_setup=true
|
||||
```
|
||||
|
||||
The var ```-e upgrade_cluster_setup=true``` is needed to be set in order to migrate the deploys of e.g kube-apiserver inside the cluster immediately which is usually only done in the graceful upgrade. (Refer to [#4139](https://github.com/kubernetes-sigs/kubespray/issues/4139) and [#4736](https://github.com/kubernetes-sigs/kubespray/issues/4736))
|
||||
@@ -46,7 +46,7 @@ existing cluster. That means there must be at least 1 kube_control_plane already
|
||||
deployed.
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/hosts.ini -e kube_version=1.19.7
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/inventory.ini -e kube_version=1.19.7
|
||||
```
|
||||
|
||||
After a successful upgrade, the Server Version should be updated:
|
||||
@@ -60,7 +60,7 @@ Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCom
|
||||
You can control how many nodes are upgraded at the same time by modifying the ansible variable named `serial`, as explained [here](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_strategies.html#setting-the-batch-size-with-serial). If you don't set this variable, it will upgrade the cluster nodes in batches of 20% of the available nodes. Setting `serial=1` would mean upgrade one node at a time.
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/hosts.ini -e kube_version=1.20.7 -e "serial=1"
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/inventory.ini -e kube_version=1.20.7 -e "serial=1"
|
||||
```
|
||||
|
||||
### Pausing the upgrade
|
||||
@@ -82,20 +82,20 @@ If you don't want to upgrade all nodes in one run, you can use `--limit` [patter
|
||||
Before using `--limit` run playbook `facts.yml` without the limit to refresh facts cache for all nodes:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook playbooks/facts.yml -b -i inventory/sample/hosts.ini
|
||||
ansible-playbook playbooks/facts.yml -b -i inventory/sample/inventory.ini
|
||||
```
|
||||
|
||||
After this upgrade control plane and etcd groups [#5147](https://github.com/kubernetes-sigs/kubespray/issues/5147):
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/hosts.ini -e kube_version=1.20.7 --limit "kube_control_plane:etcd"
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/inventory.ini -e kube_version=1.20.7 --limit "kube_control_plane:etcd"
|
||||
```
|
||||
|
||||
Now you can upgrade other nodes in any order and quantity:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/hosts.ini -e kube_version=1.20.7 --limit "node4:node6:node7:node12"
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/hosts.ini -e kube_version=1.20.7 --limit "node5*"
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/inventory.ini -e kube_version=1.20.7 --limit "node4:node6:node7:node12"
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/inventory.ini -e kube_version=1.20.7 --limit "node5*"
|
||||
```
|
||||
|
||||
## Multiple upgrades
|
||||
@@ -122,9 +122,9 @@ v2.24.0
|
||||
v2.22.0 -> v2.23.2 -> v2.24.0 : ✓
|
||||
v.22.0 -> v2.24.0 : ✕
|
||||
|
||||
Assuming you don't explicitly define a kubernetes version in your k8s_cluster.yml, you simply check out the next tag and run the upgrade-cluster.yml playbook
|
||||
Assuming you don't explicitly define a kubernetes version in your group_vars/k8s_cluster/k8s-cluster.yml, you simply check out the next tag and run the upgrade-cluster.yml playbook
|
||||
|
||||
* If you do define kubernetes version in your inventory (e.g. group_vars/k8s_cluster.yml) then either make sure to update it before running upgrade-cluster, or specify the new version you're upgrading to: `ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml -e kube_version=1.11.3`
|
||||
* If you do define kubernetes version in your inventory (e.g. group_vars/k8s_cluster/k8s-cluster.yml) then either make sure to update it before running upgrade-cluster, or specify the new version you're upgrading to: `ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml -e kube_version=1.11.3`
|
||||
|
||||
Otherwise, the upgrade will leave your cluster at the same k8s version defined in your inventory vars.
|
||||
|
||||
@@ -155,7 +155,7 @@ HEAD is now at 05dabb7e Fix Bionic networking restart error #3430 (#3431)
|
||||
|
||||
# NOTE: May need to `pip3 install -r requirements.txt` when upgrading.
|
||||
|
||||
ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
|
||||
...
|
||||
|
||||
@@ -178,7 +178,7 @@ Some deprecations between versions that mean you can't just upgrade straight fro
|
||||
In this case, I set "kubeadm_enabled" to false, knowing that it is deprecated and removed by 2.9.0, to delay converting the cluster to kubeadm as long as I could.
|
||||
|
||||
```ShellSession
|
||||
$ ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
$ ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
...
|
||||
"msg": "DEPRECATION: non-kubeadm deployment is deprecated from v2.9. Will be removed in next release."
|
||||
...
|
||||
@@ -196,7 +196,7 @@ $ git checkout v2.8.1
|
||||
Previous HEAD position was 9051aa52 Fix ubuntu-contiv test failed (#3808)
|
||||
HEAD is now at 2ac1c756 More Feature/2.8 backports for 2.8.1 (#3911)
|
||||
|
||||
$ ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
$ ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
...
|
||||
"msg": "DEPRECATION: non-kubeadm deployment is deprecated from v2.9. Will be removed in next release."
|
||||
...
|
||||
@@ -214,7 +214,7 @@ $ git checkout v2.8.2
|
||||
Previous HEAD position was 2ac1c756 More Feature/2.8 backports for 2.8.1 (#3911)
|
||||
HEAD is now at 4167807f Upgrade to 1.12.5 (#4066)
|
||||
|
||||
$ ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
$ ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
...
|
||||
"msg": "DEPRECATION: non-kubeadm deployment is deprecated from v2.9. Will be removed in next release."
|
||||
...
|
||||
@@ -232,7 +232,7 @@ $ git checkout v2.8.3
|
||||
Previous HEAD position was 4167807f Upgrade to 1.12.5 (#4066)
|
||||
HEAD is now at ea41fc5e backport cve-2019-5736 to release-2.8 (#4234)
|
||||
|
||||
$ ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
$ ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
...
|
||||
"msg": "DEPRECATION: non-kubeadm deployment is deprecated from v2.9. Will be removed in next release."
|
||||
...
|
||||
@@ -250,7 +250,7 @@ $ git checkout v2.8.4
|
||||
Previous HEAD position was ea41fc5e backport cve-2019-5736 to release-2.8 (#4234)
|
||||
HEAD is now at 3901480b go to k8s 1.12.7 (#4400)
|
||||
|
||||
$ ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
$ ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
...
|
||||
"msg": "DEPRECATION: non-kubeadm deployment is deprecated from v2.9. Will be removed in next release."
|
||||
...
|
||||
@@ -268,7 +268,7 @@ $ git checkout v2.8.5
|
||||
Previous HEAD position was 3901480b go to k8s 1.12.7 (#4400)
|
||||
HEAD is now at 6f97687d Release 2.8 robust san handling (#4478)
|
||||
|
||||
$ ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
$ ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
...
|
||||
"msg": "DEPRECATION: non-kubeadm deployment is deprecated from v2.9. Will be removed in next release."
|
||||
...
|
||||
@@ -288,14 +288,14 @@ HEAD is now at a4e65c7c Upgrade to Ansible >2.7.0 (#4471)
|
||||
```
|
||||
|
||||
> **Warning**
|
||||
> IMPORTANT: Some variable formats changed in the k8s_cluster.yml between 2.8.5 and 2.9.0
|
||||
> IMPORTANT: Some variable formats changed in the group_vars/k8s_cluster/k8s-cluster.yml between 2.8.5 and 2.9.0
|
||||
|
||||
If you do not keep your inventory copy up to date, **your upgrade will fail** and your first master will be left non-functional until fixed and re-run.
|
||||
|
||||
It is at this point the cluster was upgraded from non-kubeadm to kubeadm as per the deprecation warning.
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
|
||||
...
|
||||
|
||||
@@ -320,7 +320,7 @@ $ git checkout v2.10.0
|
||||
Previous HEAD position was a4e65c7c Upgrade to Ansible >2.7.0 (#4471)
|
||||
HEAD is now at dcd9c950 Add etcd role dependency on kube user to avoid etcd role failure when running scale.yml with a fresh node. (#3240) (#4479)
|
||||
|
||||
ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
|
||||
ansible-playbook -i inventory/mycluster/inventory.ini -b upgrade-cluster.yml
|
||||
|
||||
...
|
||||
|
||||
@@ -372,49 +372,49 @@ hosts.
|
||||
Upgrade docker:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -b -i inventory/sample/hosts.ini cluster.yml --tags=docker
|
||||
ansible-playbook -b -i inventory/sample/inventory.ini cluster.yml --tags=docker
|
||||
```
|
||||
|
||||
Upgrade etcd:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -b -i inventory/sample/hosts.ini cluster.yml --tags=etcd
|
||||
ansible-playbook -b -i inventory/sample/inventory.ini cluster.yml --tags=etcd
|
||||
```
|
||||
|
||||
Upgrade etcd without rotating etcd certs:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -b -i inventory/sample/hosts.ini cluster.yml --tags=etcd --limit=etcd --skip-tags=etcd-secrets
|
||||
ansible-playbook -b -i inventory/sample/inventory.ini cluster.yml --tags=etcd --limit=etcd --skip-tags=etcd-secrets
|
||||
```
|
||||
|
||||
Upgrade kubelet:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -b -i inventory/sample/hosts.ini cluster.yml --tags=node --skip-tags=k8s-gen-certs
|
||||
ansible-playbook -b -i inventory/sample/inventory.ini cluster.yml --tags=node --skip-tags=k8s-gen-certs
|
||||
```
|
||||
|
||||
Upgrade Kubernetes master components:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -b -i inventory/sample/hosts.ini cluster.yml --tags=master
|
||||
ansible-playbook -b -i inventory/sample/inventory.ini cluster.yml --tags=master
|
||||
```
|
||||
|
||||
Upgrade network plugins:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -b -i inventory/sample/hosts.ini cluster.yml --tags=network
|
||||
ansible-playbook -b -i inventory/sample/inventory.ini cluster.yml --tags=network
|
||||
```
|
||||
|
||||
Upgrade all add-ons:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -b -i inventory/sample/hosts.ini cluster.yml --tags=apps
|
||||
ansible-playbook -b -i inventory/sample/inventory.ini cluster.yml --tags=apps
|
||||
```
|
||||
|
||||
Upgrade just helm (assuming `helm_enabled` is true):
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -b -i inventory/sample/hosts.ini cluster.yml --tags=helm
|
||||
ansible-playbook -b -i inventory/sample/inventory.ini cluster.yml --tags=helm
|
||||
```
|
||||
|
||||
## Migrate from Docker to Containerd
|
||||
@@ -430,7 +430,7 @@ As of Kubespray 2.18.0, containerd is already the default container engine. If y
|
||||
If you want to upgrade the APT or YUM packages while the nodes are cordoned, you can use:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/hosts.ini -e system_upgrade=true
|
||||
ansible-playbook upgrade-cluster.yml -b -i inventory/sample/inventory.ini -e system_upgrade=true
|
||||
```
|
||||
|
||||
Nodes will be rebooted when there are package upgrades (`system_upgrade_reboot: on-upgrade`).
|
||||
|
||||
Reference in New Issue
Block a user