如何解决为什么kubespray ansible无法与主机匹配
我是通过kubespray安装kubernetes的,我的kubespray版本是v2.11.0,我按照官方文档逐步进行安装。但是当我执行“ ansible-playbook -i清单/mycluster/hosts.yml --become --become-user = root cluster.yml”时,我得到以下与主机不匹配的信息。
root@yinkai01:~/kubespray# ansible-playbook -i inventory/mycluster/hosts.yml --become --become-user=root cluster.yml
/usr/local/lib/python3.5/dist-packages/ansible/parsing/vault/__init__.py:41: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release ofcryptography. Please upgrade your Python.
from cryptography.exceptions import InvalidSignature
[WARNING]: Unable to parse /root/kubespray/inventory/mycluster/hosts.yml as an inventory source
[WARNING]: No inventory was parsed,only implicit localhost is available
[WARNING]: provided hosts list is empty,only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] **********************************************************************************************************************************************************
TASK [Check ansible version >=2.7.8] **************************************************************************************************************************************
Saturday 10 October 2020 07:20:40 -0400 (0:00:00.089) 0:00:00.089 ******
ok: [localhost] => {
"changed": false,"msg": "All assertions passed"
}
[WARNING]: Could not match supplied host pattern,ignoring: bastion
PLAY [bastion[0]] *********************************************************************************************************************************************************
skipping: no hosts matched
[WARNING]: Could not match supplied host pattern,ignoring: k8s-cluster
[WARNING]: Could not match supplied host pattern,ignoring: etcd
PLAY [k8s-cluster:etcd] ***************************************************************************************************************************************************
skipping: no hosts matched
PLAY [k8s-cluster:etcd] ***************************************************************************************************************************************************
skipping: no hosts matched
PLAY [etcd] ***************************************************************************************************************************************************************
skipping: no hosts matched
PLAY [k8s-cluster] ********************************************************************************************************************************************************
skipping: no hosts matched
PLAY [k8s-cluster] ********************************************************************************************************************************************************
skipping: no hosts matched
[WARNING]: Could not match supplied host pattern,ignoring: kube-master
PLAY [kube-master] ********************************************************************************************************************************************************
skipping: no hosts matched
PLAY [k8s-cluster] ********************************************************************************************************************************************************
skipping: no hosts matched
[WARNING]: Could not match supplied host pattern,ignoring: calico-rr
PLAY [calico-rr] **********************************************************************************************************************************************************
skipping: no hosts matched
PLAY [kube-master[0]] *****************************************************************************************************************************************************
skipping: no hosts matched
PLAY [kube-master] ********************************************************************************************************************************************************
skipping: no hosts matched
PLAY [kube-master] ********************************************************************************************************************************************************
skipping: no hosts matched
PLAY [k8s-cluster] ********************************************************************************************************************************************************
skipping: no hosts matched
PLAY RECAP ****************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0
Saturday 10 October 2020 07:20:40 -0400 (0:00:00.089) 0:00:00.178 ******
===============================================================================
Check ansible version >=2.7.8 -------------------------------------------------------------------------------------------------------------------------------------- 0.09s
我是主持人Yaml。我认为这与hosts.yaml无关,如下所示:
root@yinkai01:~/kubespray# cat inventory/mycluster/hosts.yaml
all:
hosts:
node1:
access_ip: 10.138.18.194
ip: 10.138.18.194
ansible_host: 10.138.18.194
node2:
access_ip: 10.138.18.195
ip: 10.138.18.195
ansible_host: 10.138.18.195
node3:
access_ip: 10.138.18.196
ip: 10.138.18.196
ansible_host: 10.138.18.196
children:
kube-master:
hosts:
node2:
node1:
kube-node:
hosts:
node3:
node2:
node1:
etcd:
hosts:
node3:
node2:
node1:
k8s-cluster:
children:
kube-node:
kube-master:
calico-rr:
hosts: {}
root@yinkai01:~/kubespray#
有人可以告诉我,我在哪里错了?
解决方法
只需在您的命令行中更改文件名(显然是拼写错误):
inventory/mycluster/hosts.yml
通过
inventory/mycluster/hosts.yaml
此警告可以帮助您:
[WARNING]: No inventory was parsed,only implicit localhost is available
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。