1.在执行k8s 初始化的时候老是报错:data could not be sent to remote host

root@master1:/etc/kubeasz# ./ezctl setup k8s-01 01
ansible-playbook -i clusters/k8s-01/hosts -e @clusters/k8s-01/config.yml  playbooks/01.prepare.yml
2022-04-17 18:05:37 INFO cluster:k8s-01 setup step:01 begins in 5s, press any key to abort:


PLAY [kube_master,kube_node,etcd] ***********************************************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************************************************
fatal: [10.0.0.161]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"10.0.0.161\". Make sure this host can be reached over ssh", "unreachable": true}
fatal: [10.0.0.171]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"10.0.0.171\". Make sure this host can be reached over ssh", "unreachable": true}
fatal: [10.0.0.170]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"10.0.0.170\". Make sure this host can be reached over ssh", "unreachable": true}
fatal: [10.0.0.165]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"10.0.0.165\". Make sure this host can be reached over ssh", "unreachable": true}
ok: [10.0.0.160]
fatal: [10.0.0.166]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"10.0.0.166\". Make sure this host can be reached over ssh", "unreachable": true}
fatal: [10.0.0.167]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"10.0.0.167\". Make sure this host can be reached over ssh", "unreachable": true}

2.分析

2.1 在ansible 本机的hosts 文件里面测试

root@master1:~# vim /etc/ansible/hosts
[master2]
10.0.0.161

2.2 执行时发现也报错

报错: /usr/bin/python: not found

root@master1:~# ansible master2 -m shell -a 'ls /root/'
10.0.0.161 | FAILED! => {
    "changed": false, 
    "module_stderr": "Shared connection to 10.0.0.161 closed.\r\n", 
    "module_stdout": "/bin/sh: 1: /usr/bin/python: not found\r\n", 
    "msg": "MODULE FAILURE", 
    "rc": 127
}

2.3 于是我安装了 python 并执行了软链接

root@master1:~# ln -s /usr/bin/python2.7 /usr/bin/python 

3.然后就完成了

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐