ansible-for-kubernetes
ansible-for-kubernetes copied to clipboard
Ch4 (cluster-local-vms) - Testing the cluster with a deployment using Ansible [SOLUTION]
Task "Create hello-k8s resources and wait until they are Ready." fails due to a bug in Python openshift 0.12: https://github.com/kubernetes-client/python/issues/1333
Error:
The full traceback is:
Traceback (most recent call last):
...
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb694668650>: Failed to establish a new connection: [Errno 111] Connection refused',))
failed: [kube1] (item=hello-k8s-deployment.yml) => {
...
\"/usr/local/lib/python2.7/dist-packages/urllib3/util/retry.py\", line 574, in increment\r\n raise MaxRetryError(_pool, url, error or ResponseError(cause))\r\nurllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb694668650>: Failed to establish a new connection: [Errno 111] Connection refused',))\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
This can be solved by setting the openshift version in the test-deployment pre_task:
pre_tasks:
- name: Ensure k8s module dependencies are installed.
pip:
name: openshift==0.11.0
state: present
@adelerhof - According to this issue (https://github.com/ansible-collections/community.kubernetes/issues/314), if you update Ansible to the latest version (2.9.17 or later or the latest 3.x version), then the problem should be resolved as well.