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: removeNodesFromKubernetesCluster accepts control, etcd and other clusters' nodes #14801
removeNodesFromKubernetesCluster does not check that the node ids belong to the cluster, or that they are nodes added with addNodesToKubernetesCluster. It only checks that each VM exists and that the caller can operate on it. Every id is handed to the remove worker, which:
drains and deletes the node from Kubernetes (by VM display name)
runs the remove script with kubeadm reset on the VM, if it has a port forwarding rule on port 22 from 2222 up
revokes the VM's port forwarding and firewall rules
lowers the cluster's node count, memory and cores
What happens for each kind of id:
id passed
result
VM in no cluster
processed, node count lowered
VM of another cluster
processed, that cluster's SSH rules for the VM revoked
control node of this cluster
drained, reset, SSH rule revoked
etcd node
processed
CKS-managed worker
reset and detached but VM left running, node count lowered
node added with addNodesToKubernetesCluster
removed (expected)
The command doc says it "Removes external nodes from a CKS cluster", and the UI only lists external nodes, but the API does not enforce this. The command also doesn't check isCommandSupported, so it runs on ExternalManaged clusters too.
versions
4.21.0 and later (4.22 branch, main)
The steps to reproduce the bug
Create a CKS cluster.
Call removeNodesFromKubernetesCluster id=<cluster> nodeids=<control node VM id>.
The control node is drained and reset, and its SSH port forwarding rule is revoked.
What to do about it?
Reject the request with a clear parameter error naming the VM unless each id is a kubernetes_cluster_vm_map row of this cluster with external_node set and neither control_node nor etcd_node set. Also reject the command on cluster types that don't support it.
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.
removeNodesFromKubernetesCluster checks only that each VM exists and that the caller can act on it. It does not check that the VM belongs to this cluster, or that it was added as an external node. A control node, an etcd node, or a node of another cluster is therefore drained, reset and has its SSH and port-forwarding rules revoked, and the cluster's node count is lowered. The command also runs on ExternalManaged clusters, which do not support it. The proposed fix is to reject any id that is not an external node of this cluster, with a clear parameter error.
📊 Assessment
Dimension
Value
Reasoning
Type
type:bug
Missing validation lets destructive operations run on the wrong nodes
Component
component:cks
removeNodesFromKubernetesCluster validation
Severity
Severity:Major
Control and etcd nodes can be removed from a running cluster
Labels
type:bug, component:cks, Severity:Major
Based on the issue text
Coding agent
Suitable
Validation rule is specified: external node of this cluster, not control or etcd, and a supported cluster type
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
removeNodesFromKubernetesClusterchecks only that each VM exists and that the caller can act on it. It does not check that the VM belongs to this cluster, or that it was added as an external node. A control node, an etcd node, or a node of another cluster is therefore drained, reset and has its SSH and port-forwarding rules revoked, and the cluster's node count is lowered. The command also runs on ExternalManaged clusters, which do not support it. The proposed fix is to reject any id that is not an external node of this cluster, with a clear parameter error.📊 Assessment
removeNodesFromKubernetesClustervalidation🔗 Similar issues
💡 Notes and suggestions
removeNodesFromKubernetesCluster, then check the cluster's node list and the control node's SSH rule.Add this agentic workflow to your repo
To install this agentic workflow, run