2

您好,提前感谢您的帮助!

我正在尝试使用 Kubespray(一个 ansible playbook)部署一个 Kubernetes 集群。我正在尝试在 17 KVM 主机上部署集群(所有节点都运行 centos 7 ,并且托管在裸机服务器上)

但是,当我尝试在任务中运行 playbook 时,[download : file_download | Download item] 出现以下错误(因此停止安装):

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: SSLError: ('The read operation timed out',)                                                                                                                              
fatal: [node1]: FAILED! => {"attempts": 4, "changed": false, "msg": "failed to create temporary content file: ('The read operation timed out',)"} 

这个错误对于大多数节点来说都是一样的,但是,一些节点愿意下载。

这是详细模式下的错误:

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_get_url_payload_72qREk/__main__.py", line 360, in url_get
    shutil.copyfileobj(rsp, f)
  File "/usr/lib64/python2.7/shutil.py", line 49, in copyfileobj
    buf = fsrc.read(length)
  File "/usr/lib64/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
  File "/usr/lib64/python2.7/httplib.py", line 602, in read
    s = self.fp.read(amt)
  File "/usr/lib64/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
  File "/usr/lib64/python2.7/ssl.py", line 757, in recv
    return self.read(buflen)
  File "/usr/lib64/python2.7/ssl.py", line 651, in read
    v = self._sslobj.read(len or 1024)
SSLError: ('The read operation timed out',)

fatal: [node14]: FAILED! => {
    "attempts": 4,
    "changed": false,
    "invocation": {
        "module_args": {
            "attributes": null,
            "backup": null,
            "checksum": "",
            "client_cert": null,
            "client_key": null,
            "content": null,
            "delimiter": null,
            "dest": "/tmp/releases/kubeadm",
            "directory_mode": null,
            "follow": false,
            "force": false,
            "force_basic_auth": false,
            "group": null,
            "headers": null,
            "http_agent": "ansible-httpget",
            "mode": "0755",
            "owner": "root",
            "regexp": null,
            "remote_src": null,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "sha256sum": "c4fc478572b5623857f5d820e1c107ae02049ca02cf2993e512a091a0196957b",
            "src": null,
            "timeout": 10,
            "tmp_dest": null,
            "unsafe_writes": null,
            "url": "https://storage.googleapis.com/kubernetes-release/release/v1.14.1/bin/linux/amd64/kubeadm",
            "url_password": null,
            "url_username": null,
            "use_proxy": true,
            "validate_certs": true
        }
    },
    "msg": "failed to create temporary content file: ('The read operation timed out',)"
}

我尝试连接到节点并尝试下载一个项目(我尝试下载 Kubspray zip)并且它工作正常,所有节点都连接到互联网并且可以安装包。

从详细的输出中,我有点明白错误来自python,但我真的不知道如何解决它......

让我知道我是否可以再给你一条信息并再次感谢您!

4

1 回答 1

3

所以,我“解决”了这个问题。

事实上,Ansbible 对于所有 ssh 相关的命令/读/写任务都有 10 秒的超时时间。由于未知原因,我节点上的写入任务有点慢,所以我收到了这个错误。幸运的是,您可以更改超时前的时间。

您可以使用参数 -T (or-tiemout) 'time_wanted' 或更改 ansible.cfg。'basic' cfg 文件位于 中etc/ansible/ansible.etc,但要小心,一些自定义 ansible playbook 会有一个自定义 ansible.cfg,因此您需要找到它并根据需要进行更改。

我很幸运,我运行 playbook 的 4 次,它顺利安装了 K8s。

出于测试原因,我在 KVM 上运行我的节点,所以写入速度可能来自这里。

希望有人会发现我的回答有用!

于 2019-05-05T12:58:06.330 回答