Ansible 'wait_for_connection' "Error reading SSH protocol banner" (超时) 从 Kubernetes pod



短背景;
我在 EC2 上创建了一个 Jenkins master,并将一个 Kubernetes 集群作为 worker (Amazon EKS(。
我使用了 Kubernetes 插件并创建了一个模仿主节点的安装、版本和先决条件的 jnlp 从属映像。
一切都按预期工作,直到我在创建实例后立即执行了"wait_for_connection"模块;

- name: Wait for system to become reachable
hosts: just_created
remote_user: "{{ remote_image_user }}"
gather_facts: false
become: True
become_user: root
vars:
remote_image_user: "ec2-user"
tasks:
- name: Wait for system to become reachable
wait_for_connection:

从工作线程容器收到的超时错误:

fatal: FAILED! => {"changed": false, "elapsed": 600, "msg": "timed out waiting for ping module test success: Error reading SSH protocol banner"}

附加信息:

  1. 连接是使用公共 IP 执行的,我确实有从 EKS 工作节点 (EC2( 到主机 IP 的远程登录。
  2. 如果主节点 (EC2( 正在运行它,则相同的确切模块工作。
  3. Jenkins master 和 pod 都有相同的 Ansible --version:
ansible 2.7.10
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Jun 16 2020, 13:32:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

我错过了什么? 为什么 ansible 很难从 Pod 内部通过 SSH 连接到另一台主机?

对于那些面临相同问题的人, 我找到了原因,需要对 ansible 进行一些更改.cfg:

host_key_checking = False
record_host_keys=False

最新更新