ansible-role-kubernetes
ansible-role-kubernetes copied to clipboard
Ensure Kubelet is stopped before kubeadm join command
This change ensures that the kublet is in a stopped state before running the kubeadm join commands. This prevents preflight errors such as "Port 10250 is in use", e.g.:
This is occurring on at least Ubuntu 20 in AWS. The issue is that kubelet is running and already using port 10250 before the kubeadm join command is executed. Then, when the command is executed, it sees port 10250 is already in use by something and fails. And although it is the kubelet itself that is using the port, kubeadm doesn't seem smart enough to realize that.
I understand that I can set kubernetes_join_command_extra_opts: "--ignore-preflight-errors=all" to work around this issue, but I'd rather not ignore all preflight checks if possible. There's really no need to start the kubelet the way it is currently being done.
This change breaks the role's idempotence, however—it forces the service to be stopped any time it runs...
@geerlingguy I don't think that's true....or the Ansible docs are wrong. From here: "started/stopped are idempotent actions that will not run commands unless necessary."
I'm looking at the CI job for this branch (see the checks listed at the bottom of this PR), which is showing up as having idempotence tests failing with this change: https://github.com/geerlingguy/ansible-role-kubernetes/actions/runs/8190549299/job/22397750385?pr=154#step:5:436
How exactly does that test work? The Ansible docs say otherwise with regards to idempotency. Additionally, how would a test like that even work for some of those tasks that can never be idempotent, e.g. using the shell task?
Would you prefer that I put a changed_when: false on that task? That should solve the test failure I would assume.
@rbaxende, please look at this, as I believe it solves the current issue and addresses the idempotency concerns. Feel free to use this for the PR
https://github.com/rothman857/ansible-role-kubernetes/blob/update/tasks/node-setup.yml
This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
This pr has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.