techno-tim / k3s-ansible

The easiest way to bootstrap a self-hosted High Availability Kubernetes cluster. A fully automated HA k3s etcd install with kube-vip, MetalLB, and more. Build. Destroy. Repeat.
https://technotim.live/posts/k3s-etcd-ansible/
Apache License 2.0
2.41k stars 1.05k forks source link

Node taints enabled by default on a cluster that consists of multiple masters and zero nodes #99

Closed gbyczyns closed 2 years ago

gbyczyns commented 2 years ago

Context

I have a cluster that consist of master nodes only:

hosts.ini

[master]
server1.mydomain.com
server2.mydomain.com
server3.mydomain.com

[node]

[k3s_cluster:children]
master
node

Expected Behavior

Node taints shouldn't be enabled if there are master nodes only. All the master nodes should be able to accept workload.

Current Behavior

Taints are added to all master nodes, and since there are no regular nodes, it's not possible to run any workload on the cluster.

$ kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints --no-headers
server1.mydomain.com   [map[effect:NoExecute key:CriticalAddonsOnly value:true]]
server2.mydomain.com   [map[effect:NoExecute key:CriticalAddonsOnly value:true]]
server3.mydomain.com   [map[effect:NoExecute key:CriticalAddonsOnly value:true]]

The reason lies in one of the recent commits (4acbe91b6c3a25a8f693df7c11789e1947842425) that added this variable:

k3s_single_node: "{{ 'true' if groups['k3s_cluster'] | length == 1 else 'false' }}"
sleiner commented 2 years ago

I suppose that will be fixed with #95 - do you agree?

gbyczyns commented 2 years ago

You're right, this issue can be closed. Thank you!