bhouse-nexthop opened a new issue, #14830: URL: https://github.com/apache/cloudstack/issues/14830
### problem CKS picks "the control node" in `KubernetesClusterActionWorker.fetchControlVmIfMissing` by sorting every VM id in `kubernetes_cluster_vm_map` and taking the one at index `etcdNodeCount`. It never looks at the `control_node` flag. If the cluster holds a VM whose id is lower than the control VM's, that VM is taken as the control node. The easy way to hit it: `addNodesToKubernetesCluster` with a VM that existed before the cluster was created. | caller | what goes wrong | |---|---| | `KubernetesClusterAddWorker` (`getControlVmPrivateIp`) | every later added node gets join config pointing at the worker's IP:6443; its `deploy-kube-system` loops on "Couldn't connect to server" | | `getKubernetesClusterServerIpSshPortForSharedNetwork` | shared/routed clusters SSH to the worker instead of the control node (scale, upgrade, add, remove) | | `KubernetesClusterStartWorker.isKubernetesClusterKubeConfigAvailable` | kubeconfig server rewrite looks for the wrong IP and is skipped | Seen on a lab cluster: VMs 4 and 5 added with addNodesToKubernetesCluster (external, worker), control VM is 7. VM 4 was chosen; adding VM 5 afterwards produced a join config pointing at VM 4. ### versions 4.22 (also main). Code unchanged since etcd node support. ### The steps to reproduce the bug 1. Create a VM A (CKS template) in the cluster's network. 2. Create a CKS cluster (VM ids of its nodes are now higher than A's). 3. `addNodesToKubernetesCluster` with A; it joins fine (control IP still resolved correctly until A is mapped). 4. `addNodesToKubernetesCluster` with another existing VM B. 5. B's CKS config points at A's IP for the API server and never joins. ### What to do about it? Pick the control VM from rows with `control_node` set (not etcd, not external), lowest VM id first. Keep a fallback for clusters created before the `control_node` column existed (all rows 0). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
