You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CKS add-node can pick an SSH port a live node uses after a node is removed #14797
CKS add-node picks the new node's SSH port from the node count, not from the ports in use. After removing an added node that is not the last one, the next add-node picks a port a live node still uses, and the add fails on a rule conflict.
In KubernetesClusterAddWorker.validateAndSetupNode:
On an isolated network the firewall rule create fails (The range specified, 2226-2226, conflicts with rule ...). On a VPC tier the PF rule is saved without a conflict check, so two PF rules share the port.
versions
4.22 and main (same code). Any CKS cluster that uses add-node / remove-node with external VMs.
The steps to reproduce the bug
Create a CKS cluster (1 control, 2 workers) on an isolated network.
addNodesToKubernetesCluster with VM A, then with VM B.
removeNodesFromKubernetesCluster with VM A.
addNodesToKubernetesCluster with VM C: it fails on port 2226.
What to do about it?
Pick the lowest port from 2222 up that no rule on the cluster's public IP is using, so a gap left by a removed node is reused and live nodes' ports are never taken. Existing nodes keep their ports.
threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.
What happened
The threat detection engine failed to produce results.
CKS add-node picks the new node's SSH port from the total node count, not from the ports in use. After a node that is not the last one is removed, the next add can pick a port a live node still uses. On an isolated network the firewall rule create then fails on a conflict. On a VPC tier the port-forwarding rule is saved without a conflict check, so two rules can share a port. The proposed fix is to take the lowest free port from 2222 that no rule on the cluster's public IP uses, leaving existing nodes unchanged.
📊 Assessment
Dimension
Value
Reasoning
Type
type:bug
Port allocation collides with live nodes, with a worked example
Component
component:cks
KubernetesClusterAddWorker.validateAndSetupNode
Severity
Severity:Major
Add-node fails on isolated networks; duplicate rules on VPC tiers
Labels
type:bug, component:cks, Severity:Major
Based on the issue text
Coding agent
Suitable
Specific allocation rule given, with existing nodes unchanged
Activity
github-actions commentedon Nov 30, 2026
Warning
threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.
What happened
The threat detection engine failed to produce results.
Review the workflow run logs for details.
🎯 Triage report
CKS add-node picks the new node's SSH port from the total node count, not from the ports in use. After a node that is not the last one is removed, the next add can pick a port a live node still uses. On an isolated network the firewall rule create then fails on a conflict. On a VPC tier the port-forwarding rule is saved without a conflict check, so two rules can share a port. The proposed fix is to take the lowest free port from 2222 that no rule on the cluster's public IP uses, leaving existing nodes unchanged.
📊 Assessment
KubernetesClusterAddWorker.validateAndSetupNode🔗 Similar issues
💡 Notes and suggestions
Add this agentic workflow to your repo
To install this agentic workflow, run