CKS: nothing detects drift between a cluster's VM map, its VMs and its Kubernetes nodes

Aperta
#14,665 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@bhouse-nexthop ci sta già lavorando.

Dal 10/11/2026.

  • #14666 di @bhouse-nexthop — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java, kubernetes

Direzione di ricerca

Start by reading the CKS cluster status scanner and its handling of cluster VMs, then trace how it can access the cluster's Kubernetes nodes and raise alerts and events. Compare the VM map, actual VMs, and Kubernetes nodes for each mismatch. Done means each mismatch produces an alert and event naming the cluster and affected VM or node once, without changing the map.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

problem

CKS keeps the list of VMs of each Kubernetes cluster in kubernetes_cluster_vm_map. Scale, upgrade, stop/start and the cluster status scanner all trust that list. Nothing checks it against the VMs that actually exist or against the nodes Kubernetes knows about, so when the two drift apart nobody is told:

  • a VM that is in the map but has been destroyed or expunged, or no longer exists, keeps the cluster in Alert (the scanner compares the map's size and VM states against the expected node count), and the next scale or upgrade works from a wrong list;
  • a VM that runs as a node of the cluster but is not in the map is invisible to CloudStack: it is not scaled, upgraded, stopped or deleted with the cluster;
  • a Kubernetes node with no VM behind it, or a mapped running VM that is not a Kubernetes node, means the cluster Kubernetes runs is not the one CloudStack thinks it manages.

The API and UI refuse to destroy a VM that belongs to a CKS cluster, so the map does not drift through normal use. It drifts when:

  • a node is rebuilt or replaced by hand (a new VM joined to the cluster, the old one removed outside CKS);
  • the database is edited by hand;
  • a destroy or expunge fails during a scale-down, which removed the VM from the map but could leave the VM behind. That path is fixed in #14611.

A production cluster was found sitting in Alert with one of its control nodes missing from the map. The only way to find out why was to compare the map, the VMs and kubectl get nodes by hand.

versions

4.22 and main.

The steps to reproduce the bug
  1. Create a CKS cluster and wait for it to be Running.
  2. Remove one of its rows from kubernetes_cluster_vm_map (or replace a worker node by hand with a new VM that joins the cluster).
  3. The cluster moves to Alert, or keeps a node CloudStack does not know about, and no alert or event says which VM or node is the cause.
What to do about it?

Have the cluster status scanner compare the map with the cluster's VMs and its Kubernetes nodes, and raise an alert and an event naming the cluster and the VM or node for each mismatch, once per mismatch. Detection only, the map is not changed.

Lingua principale
Java
Stelle
3.1k
Fork
1.4k
Merge medio
7g 16h
PR unite (30g)
15

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/cloudstack

Tutte le issue di apache/cloudstack

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.