-
Hey, everyone at Flatcar! Thanks for providing such an excellent operating system! I'm currently in the process of deploying a substantial setup with Flatcar, and I need some best practice tips. What’s the best way to get the Docker process within Flatcar joined to a swarm? My best guess is to create a systemd unit with an ExecStart to join the swarm. However, wouldn’t that run on every boot? What’s the best way to check if it is already joined? If anyone is already running this setup, I’d be glad if you could share your experience. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
So you either run something like Ansible outside the nodes or inspect the response from the join command? I don't know how granular it is since the node could be already joined, there could be transport errors and the token could be expired. But maybe that gives you a hint as to if the node has joined. I am still using Ansible for this part - basically do a docker node ls, parse and add/remove workers with a dynamic inventory. I guess the systemd way would be to set a pre condition in the unit, e.g. a file shouldn't exist and then you execute the join command and create the file. But I find that hacky and also leaves questions open for a DR (when managers break). |
Beta Was this translation helpful? Give feedback.
-
Hi @Theni224 if you want to go ahead with a Systemd unit + ExecStart you can give a try to |
Beta Was this translation helpful? Give feedback.
So you either run something like Ansible outside the nodes or inspect the response from the join command? I don't know how granular it is since the node could be already joined, there could be transport errors and the token could be expired.
But maybe that gives you a hint as to if the node has joined.
I am still using Ansible for this part - basically do a docker node ls, parse and add/remove workers with a dynamic inventory.
I guess the systemd way would be to set a pre condition in the unit, e.g. a file shouldn't exist and then you execute the join command and create the file.
But I find that hacky and also leaves questions open for a DR (when managers break).