Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add new node to swarm cluster using docker_swarm #876

Closed
kimdre opened this issue Jun 5, 2024 · 2 comments
Closed

Cannot add new node to swarm cluster using docker_swarm #876

kimdre opened this issue Jun 5, 2024 · 2 comments
Labels
docker-swarm Docker Swarm question Further information is requested third-party-bug This is a bug in some other software, not in ours

Comments

@kimdre
Copy link

kimdre commented Jun 5, 2024

SUMMARY

I'm trying to add an additional worker node to my swarm cluster but the ansible playbook when triying to join the second worker node.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
- hosts: server_type_worker
  tasks:
    - name: add workers to swarm
      docker_swarm:
        state: join
        advertise_addr: "{{private_ipv4}}"
        remote_addrs: ["{{hostvars['manager-1'].private_ipv4}}"]
        join_token: "{{hostvars['manager-1'].swarm_init_result.swarm_facts.JoinTokens.Worker}}"
COLLECTION VERSION
# /home/kim/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.docker 3.10.3 

# /usr/lib/python3.12/site-packages/ansible_collections
Collection       Version
---------------- -------
community.docker 3.9.0  
CONFIGURATION
CONFIG_FILE() = /home/kim/Git/Magicline/magicline-server-deployment/ansible/ansible.cfg
DEFAULT_HOST_LIST(/home/kim/Git/Magicline/magicline-server-deployment/ansible/ansible.cfg) = ['/home/kim/Git/Magicline/magicline-server-deployment/ansible/inventory/prod.hcloud.yaml']
DEFAULT_REMOTE_USER(/home/kim/Git/Magicline/magicline-server-deployment/ansible/ansible.cfg) = root
EDITOR(env: EDITOR) = code --wait
HOST_KEY_CHECKING(/home/kim/Git/Magicline/magicline-server-deployment/ansible/ansible.cfg) = False
INVENTORY_ENABLED(/home/kim/Git/Magicline/magicline-server-deployment/ansible/ansible.cfg) = ['hcloud']
PAGER(env: PAGER) = most
OS / ENVIRONMENT

Fedora 40 and also Github Actions on Linux Runner
Worker Node has Ubuntu 24.04 LTS

STEPS TO REPRODUCE
...
- hosts: server_type_worker
  tasks:
    - name: add workers to swarm
      docker_swarm:
        state: join
        advertise_addr: "{{private_ipv4}}"
        remote_addrs: ["{{hostvars['manager-1'].private_ipv4}}"]
        join_token: "{{hostvars['manager-1'].swarm_init_result.swarm_facts.JoinTokens.Worker}}"
EXPECTED RESULTS
ACTUAL RESULTS

worker-1 already exists, worker-2 is the new node.

TASK [add workers to swarm] ********************************************************************************************************************************************************************************************************
ok: [worker-1]
fatal: [worker-2]: FAILED! => {"changed": false, "msg": "Error connecting: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'"}
@felixfontein felixfontein added question Further information is requested docker-swarm Docker Swarm labels Jun 6, 2024
@felixfontein
Copy link
Collaborator

You probably want to upgrade Docker SDK for Python on the target where the module is executed.

This bug was tracked in docker/docker-py#3113 and got fixed in Docker SDK for Python 7.0.0. You can alternatively downgrade urllib3 to a version < 2.

@felixfontein felixfontein added the third-party-bug This is a bug in some other software, not in ours label Jun 6, 2024
@kimdre
Copy link
Author

kimdre commented Jun 6, 2024

Thank you! After installing docker on the new fresh node, the python docker SDK was still on 5.0.3 instead of >7.0.0 so I had to install the latest version manually. This fixed it for me. :)

@kimdre kimdre closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker-swarm Docker Swarm question Further information is requested third-party-bug This is a bug in some other software, not in ours
Projects
None yet
Development

No branches or pull requests

2 participants