我是通过 kubespray 安装 kubernetes,我的 kubespray 版本是 v2.11.0,我按照官方文档一步一步安装。但是当我执行“ansible-playbook -i inventory/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#
谁能告诉我,我哪里错了?</p>