0

我想安装KubernetesKubespary但 python 包有问题。我使用Ubuntu 20.10python3

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

当我使用此命令运行 ansible 角色时:

ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml 我有这个错误。


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

我该如何解决这个问题? "msg": "No package matching 'python-apt' is available"} 谢谢。

4

2 回答 2

1

问题 - https://github.com/kubernetes-sigs/kubespray/issues/7362

解决方法 - \roles\kubernetes\preinstall\vars\ubuntu.yml

---
required_pkgs:
  - python3-apt
  - aufs-tools
  - apt-transport-https
  - software-properties-common
  - conntrack

于 2021-05-09T21:00:46.020 回答
0

遇到同样的问题。原因应该是 ubuntu20.10 完全丢弃了 python2 存储库。在 Ubuntu 20.04 上运行 apt list python-apt:

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

在 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
于 2021-01-15T20:23:24.720 回答