Skip to content

CKS: removeNodesFromKubernetesCluster accepts control, etcd and other clusters' nodes #14801

Open

Description

@bhouse-nexthop

problem

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

  1. Create a CKS cluster.
  2. Call removeNodesFromKubernetesCluster id=<cluster> nodeids=<control node VM id>.
  3. 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.

Activity

  1. github-actions commented on Nov 30, 2026

    @github-actions

    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

    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

    🔗 Similar issues

    💡 Notes and suggestions
    • Reproduction: pass a control node's VM id to removeNodesFromKubernetesCluster, then check the cluster's node list and the control node's SSH rule.
    • Reject the request before any drain or reset starts, so nothing is partly applied.

    Generated by Daily Issue Triage · copilot · haiku55 · ~8 AIC · ⊞ 3.8K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/daily-issue-triage.md@139fa09ef17cde4135e696ff8e7af09bc5ddfa6e
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions