Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
833 views
in Technique[技术] by (71.8m points)

ansible - kubespray and problem with python package

I want install Kubernetes with Kubespary but I have a problem with the python package. I use Ubuntu 20.10 and python3

ansible --version
ansible 2.9.6
  config file = /opt/kubespray/ansible.cfg
  configured module search path = ['/opt/kubespray/library']
  ansible python module location = /opt/ansible/lib/python3.8/site-packages/ansible
  executable location = /opt/ansible/bin/ansible
  python version = 3.8.6 (default, Sep 25 2020, 09:36:53) [GCC 10.2.0]

pip3 freeze
ansible==2.9.6
cffi==1.14.4
cryptography==3.3.1
Jinja2==2.11.1
jmespath==0.9.5
MarkupSafe==1.1.1
netaddr==0.7.19
pbr==5.4.4
pkg-resources==0.0.0
pycparser==2.20
PyYAML==5.3.1
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.2
six==1.15.0

When I run ansible role with this command:

ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml I have this error.


TASK [kubernetes/preinstall : Update common_required_pkgs with ipvsadm when kube_proxy_mode is ipvs] *********************************************************************************************************
ok: [node1]
ok: [node2]
ok: [node3]
ok: [node4]
ok: [node5]
Monday 11 January 2021  09:34:05 +0000 (0:00:00.137)       0:00:34.827 ********
FAILED - RETRYING: Install packages requirements (4 retries left).
FAILED - RETRYING: Install packages requirements (4 retries left).
FAILED - RETRYING: Install packages requirements (4 retries left).
FAILED - RETRYING: Install packages requirements (4 retries left).
FAILED - RETRYING: Install packages requirements (4 retries left).
FAILED - RETRYING: Install packages requirements (3 retries left).
FAILED - RETRYING: Install packages requirements (3 retries left).
FAILED - RETRYING: Install packages requirements (3 retries left).
FAILED - RETRYING: Install packages requirements (3 retries left).
FAILED - RETRYING: Install packages requirements (3 retries left).
FAILED - RETRYING: Install packages requirements (2 retries left).
FAILED - RETRYING: Install packages requirements (2 retries left).
FAILED - RETRYING: Install packages requirements (2 retries left).
FAILED - RETRYING: Install packages requirements (1 retries left).
FAILED - RETRYING: Install packages requirements (2 retries left).
FAILED - RETRYING: Install packages requirements (2 retries left).
FAILED - RETRYING: Install packages requirements (1 retries left).
FAILED - RETRYING: Install packages requirements (1 retries left).

TASK [kubernetes/preinstall : Install packages requirements] ****************************************************************************************************
fatal: [node1]: FAILED! => {"attempts": 4, "changed": false, "msg": "No package matching 'python-apt' is available"}
fatal: [node2]: FAILED! => {"attempts": 4, "changed": false, "msg": "No package matching 'python-apt' is available"}
fatal: [node5]: FAILED! => {"attempts": 4, "changed": false, "msg": "No package matching 'python-apt' is available"}
FAILED - RETRYING: Install packages requirements (1 retries left).
FAILED - RETRYING: Install packages requirements (1 retries left).
fatal: [node4]: FAILED! => {"attempts": 4, "changed": false, "msg": "No package matching 'python-apt' is available"}
fatal: [node3]: FAILED! => {"attempts": 4, "changed": false, "msg": "No package matching 'python-apt' is available"}

NO MORE HOSTS LEFT *********************************************************************************************************

PLAY RECAP ************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
node1                      : ok=69   changed=1    unreachable=0    failed=1    skipped=90   rescued=0    ignored=0
node2                      : ok=54   changed=1    unreachable=0    failed=1    skipped=75   rescued=0    ignored=0
node3                      : ok=52   changed=1    unreachable=0    failed=1    skipped=77   rescued=0    ignored=0
node4                      : ok=51   changed=1    unreachable=0    failed=1    skipped=78   rescued=0    ignored=0
node5                      : ok=51   changed=1    unreachable=0    failed=1    skipped=78   rescued=0    ignored=0

How do I fix this problem? "msg": "No package matching 'python-apt' is available"} Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Ran into the same problem. The cause should be ubuntu20.10 totally discards python2 repository. Run apt list python-apt on Ubuntu 20.04:

$apt list python-apt
python-apt/focal 2.0.0 amd64
python-apt/focal 2.0.0 i386

on Ubuntu 20.10:

$apt show python-apt
Package: python-apt
State: not a real package (virtual)
N: Can't select candidate version from package python-apt as it has no candidate
N: Can't select versions from package 'python-apt' as it is purely virtual
N: No packages found

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...