Closed ubersol closed 1 month ago
I rerun pip3 install -U -r requirements.txt
just to make sure I have the latest ansible version:
ansible [core 2.16.11]
config file = /root/Ansible/kubespray/ansible.cfg
configured module search path = ['/root/Ansible/kubespray/library']
ansible python module location = /root/py311env/lib64/python3.11/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /root/py311env/bin/ansible
python version = 3.11.9 (main, Jul 2 2024, 17:31:52) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22.0.1)] (/root/py311env/bin/python3.11)
jinja version = 3.1.4
libyaml = True
and rerun the upgrade process, it did fail at the exact same spot with the same message.
the kubeadm_patches
changed format in #11521 , you need to adjust your inventory.
Hi @VannTen , thank you for the quick response, but I am not sure I understand the format change mentioned in #11521 .. Currently my kubespray/inventory/myapp/inventory.ini looks like this:
[all]
myapp10 ansible_host=7.40.11.52 ansible_python_interpreter=/usr/bin/python3.6 ansible_become=true
myapp11 ansible_host=7.40.10.227 ansible_become=true
myapp12 ansible_host=7.40.11.14 ansible_become=true
myapp13 ansible_host=7.40.11.3 ansible_become=true
myapp14 ansible_host=7.40.11.51 ansible_become=true
myapp15 ansible_host=7.40.11.46 ansible_become=true
[kube_control_plane]
myapp10
myapp11
myapp12
[etcd]
myapp10
myapp11
myapp12
[kube_node]
myapp13
myapp14
myapp15
[calico_rr]
[k8s_cluster:children]
kube_control_plane
kube_node
calico_rr
and from the https://github.com/kubernetes-sigs/kubespray/blob/master/inventory/sample/inventory.ini, it looks like there is etc_member
added like:
etcd_member_name=
Do I also need to place this inside the [all] section like below ?
[all]
myapp10 ansible_host=7.40.11.52 ansible_python_interpreter=/usr/bin/python3.6 ansible_become=true etcd_member_name=etcd1
myapp11 ansible_host=7.40.10.227 ansible_become=true etcd_member_name=etcd2
myapp12 ansible_host=7.40.11.14 ansible_become=true etcd_member_name=etcd3
myapp13 ansible_host=7.40.11.3 ansible_become=true
myapp14 ansible_host=7.40.11.51 ansible_become=true
myapp15 ansible_host=7.40.11.46 ansible_become=true
Could you be so kind to clarify this a little bit? Also, is there a documentation about this change ( I am sorry I looked, but can't find it ) ?
Hi @VannTen ,
I tried the following in the inventory file:
[all]
myapp10 ansible_host=7.40.11.52 ansible_python_interpreter=/usr/bin/python3.6 ansible_become=true etcd_member_name=etcd1
myapp11 ansible_host=7.40.10.227 ansible_become=true etcd_member_name=etcd2
myapp12 ansible_host=7.40.11.14 ansible_become=true etcd_member_name=etcd3
myapp13 ansible_host=7.40.11.3 ansible_become=true
myapp14 ansible_host=7.40.11.51 ansible_become=true
myapp15 ansible_host=7.40.11.46 ansible_become=true
but again, it failed with :
TASK [kubernetes/kubeadm_common : Kubeadm | Copy kubeadm patches from inventory files] ***
fatal: [myapp10]: FAILED! => {"msg": "Invalid data passed to 'loop', it requires a list, got this instead: {'enabled': False, 'source_dir': '/root/Ansible/kubespray/inventory/mycluster/patches', 'dest_dir': '/etc/kubernetes/patches'}. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your lookup invocation or use q/query instead of lookup."}
You've copied the sample inventory some times ago.
In there, there is a kubeam_patches
variable whose format has changed with the above PR.
If you don't need it, just delete that variable, otherwise, adapt it to
the new format.
The docs are linked to in the PR release notes, not sure what more I can do :shrug:
If you need further support, please go to the kubespray slack channel which is for that purpose, thanks !
/close /kind support
@VannTen: Closing this issue.
You've copied the sample inventory some times ago. In there, there is a
kubeam_patches
variable whose format has changed with the above PR. If you don't need it, just delete that variable, otherwise, adapt it to the new format.The docs are linked to in the PR release notes, not sure what more I can do 🤷
Ah yes, that's right I did copy the sample inventory back in v1.29 something...I misunderstood what you said about inventory, I thought you meant the inventory file :). Thank you for your help!, greatly appreciate it. I edited the the file : inventory/mycluster/group_vars/k8s_cluster/k8s-cluster.yml
with the following changes before rerunning it:
# kubeadm patches path
kubeadm_patches_dir: "{{ kube_config_dir }}/patches"
kubeadm_patches: []
#kubeadm_patches:
# enabled: false
# source_dir: "{{ inventory_dir }}/patches"
# dest_dir: "{{ kube_config_dir }}/patches"
which is I think what you meant! and lastly just out of curiosity, is it the best practice to cp the sample inventory directory each time we have a new version with kubespray and then do the customizations? Thanks again for your help and time. I was able to upgrade without any issues.
and lastly just out of curiosity, is it the best practice to cp the sample inventory directory each time we have a new version with kubespray and then do the customizations? Thanks again for your help and time.
Nope, the best practice is to only put in your inventory what you need, an nothing more, and never copy the sample inventory at all.
/rant on This is a sore point of our documentation, and it cause the same kind of misunderstanding you had quite regularly, unfortunately ^ see #10645 or #10697 /rant off
What happened?
Executed :
ansible-playbook -i inventory/mycluster/inventory.ini --become-user=root upgrade-cluster.yml | tee -a upgrade_cluster_to_1-31-1.txt
to upgrade the cluster to 1.31.4 after changing the variablekube_version: v1.31.1
ininventory/mycluster/group_vars/k8s_cluster/k8s-cluster.yml
and the upgrade of failed with the following messages:After this listing the nodes:
What did you expect to happen?
I expected the upgrade process not fail immediately and finish
How can we reproduce it (as minimally and precisely as possible)?
Upgrade from 1.30.4 to 1.31.1 and change inventory variable
OS
04:31:09 # printf "$(uname-srm)\n$(cat /etc/os-release)\n" -bash: uname-srm: command not found
NAME="Oracle Linux Server" VERSION="8.10" ID="ol" ID_LIKE="fedora" VARIANT="Server" VARIANT_ID="server" VERSION_ID="8.10" PLATFORM_ID="platform:el8" PRETTY_NAME="Oracle Linux Server 8.10" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:oracle:linux:8:10:server" HOME_URL="https://linux.oracle.com/" BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8" ORACLE_BUGZILLA_PRODUCT_VERSION=8.10 ORACLE_SUPPORT_PRODUCT="Oracle Linux" ORACLE_SUPPORT_PRODUCT_VERSION=8.10
Version of Ansible
Version of Python
04:32:17 # python --version Python 3.11.9
Version of Kubespray (commit)
15bb5b078
Network plugin used
flannel
Full inventory with variables
Unable to get this directly
Command used to invoke ansible
ansible-playbook -i inventory/mycluster/inventory.ini --become-user=root upgrade-cluster.yml | tee -a upgrade_cluster_to_1-31-1.txt
Output of ansible run
https://gist.github.com/ubersol/82ecde969062b03df65daa89fcccc32c
Anything else we need to know
No response