我在两个节点上运行了Kubespray,现在我试图运行自己的Ansible Playbook来部署我的Kubernetes集群。 当我运行k8s playbook命令创建名称空间(或任何其他k8s对象创建命令)时,我收到以下错误消息:
Traceback (most recent call last):
File "/home/Patrick/.ansible/tmp/ansible-tmp-1547837481.1-223460946163844/AnsiballZ_k8s.py", line 113, in <module>
_ansiballz_main()
File "/home/Patrick/.ansible/tmp/ansible-tmp-1547837481.1-223460946163844/AnsiballZ_k8s.py", line 105, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/Patrick/.ansible/tmp/ansible-tmp-1547837481.1-223460946163844/AnsiballZ_k8s.py", line 48, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File "/tmp/ansible_k8s_payload_tSXyYV/__main__.py", line 171, in <module>
File "/tmp/ansible_k8s_payload_tSXyYV/__main__.py", line 167, in main
File "/tmp/ansible_k8s_payload_tSXyYV/ansible_k8s_payload.zip/ansible/module_utils/k8s/raw.py", line 89, in execute_module
File "/tmp/ansible_k8s_payload_tSXyYV/ansible_k8s_payload.zip/ansible/module_utils/k8s/common.py", line 174, in get_api_client
File "/usr/local/lib/python2.7/dist-packages/openshift/dynamic/client.py", line 58, in __init__
self._load_server_info()
File "/usr/local/lib/python2.7/dist-packages/openshift/dynamic/client.py", line 62, in _load_server_info
self.__version = {'kubernetes': load_json(self.request('get', '/version'))}
File "/usr/local/lib/python2.7/dist-packages/openshift/dynamic/client.py", line 253, in request
_return_http_data_only=params.get('_return_http_data_only', True)
TypeError: call_api() got an unexpected keyword argument 'async'
那是我要执行的剧本:
---
- hosts: webapp
name: Deploy the whole webapp
tasks:
- name: Install Openshift Pip module
pip:
name: openshift
- name: Create a k8s namespace
k8s:
name: webapp
api_version: v1
kind: Namespace
state: present
我用来启动剧本的命令是ansible-playbook -i hosts.ini --become --become-user=root webapp.yml
我没有办法调试该问题,并希望有人知道如何解决该问题。
致谢
帕特里克