Closed trotro closed 1 year ago
@trotro You need to make sure that the python instance on the remote node has kubernetes installed.
Hello, I have the same issue with ansible-core version 2.12.6
I am confuse, because the lastest kubernetes version is 1.25 ( see kubenetes release)
And yes, the remote node (AlmaLinux 8.6 for me) has kubernetes and python3-kubernetes installed.
For information:
# kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.0", GitCommit:"a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2", GitTreeState:"clean", BuildDate:"2022-08-23T17:43:25Z", GoVersion:"go1.19", Compiler:"gc", Platform:"linux/amd64"}
# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-master-1 Ready control-plane 51m v1.25.0 10.0.0.1 <none> AlmaLinux 8.6 (Sky Tiger) 4.18.0-372.16.1.el8_6.x86_64 containerd://1.6.8
k8s-worker-1 Ready worker 50m v1.25.0 10.0.0.2 <none> AlmaLinux 8.6 (Sky Tiger) 4.18.0-372.16.1.el8_6.x86_64 containerd://1.6.8
k8s-worker-2 Ready worker 50m v1.25.0 10.0.0.3 <none> AlmaLinux 8.6 (Sky Tiger) 4.18.0-372.16.1.el8_6.x86_64 containerd://1.6.8
If you have confirmed that the remote python has all the required dependencies installed, you can try setting the ansible_python_interpreter
to ensure the correct interpreter is being used: https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html
If you have confirmed that the remote python has all the required dependencies installed, you can try setting the
ansible_python_interpreter
to ensure the correct interpreter is being used: https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html
Sorry for the late reply. You spotted the cause. The interpreter on the remote was not the good one. Thank you.
SUMMARY
After upgrading from Ansible 2.9 to Ansible 2.13 I have an error when running tasks using kubernetes.core.k8s. It says that a dependency is missing or on the wrong version but it is installed with the latest version, which is superior to the requirements.
ISSUE TYPE
COMPONENT NAME
kubernetes.core.k8s
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
$ cat /etc/redhat-release Red Hat Enterprise Linux release 8.6 (Ootpa) $ uname -a Linux 27a985eddbfe 3.10.0-1160.76.1.el7.x86_64 #1 SMP Tue Jul 26 14:15:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux $ python -m pip freeze | grep 'ansible\|kubernetes' ansible==6.3.0 ansible-bender==0.9.0 ansible-compat==2.2.0 ansible-core==2.13.3 ansible-lint==6.5.0 kubernetes==24.2.0
STEPS TO REPRODUCE
Run a playbook with task below
EXPECTED RESULTS
The task is working and deploying the k8s resources.
ACTUAL RESULTS
It seems the check_library_version function is not using the same code as the other calls to LooseVersion like the one line 228. I'm not good enough in Python to say for sure, but that may be an hint.