CKS: clusters never become Ready on default KVM guest CPU model — Calico binaries (3.32.2) require x86-64-v2, failure is undiscoverable
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- java, kubernetes
- Bereich
- backend-api-design, cloud, infrastructure
Rechercherichtung
Start with KubernetesClusterResourceModifierActionWorker.java:408-413 and trace how customParameterMap reaches VM details, then compare that flow with LibvirtComputingResource.java:3310-3314 and HypervisorGuruBase.java:329. Reproduce the CKS deployment failure with the default KVM CPU model. Done means the selected fix makes the required CPU capability discoverable or available before node creation, with coverage for the resulting deployment behavior.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
problem
A CKS cluster deployed on KVM hosts using CloudStack's default guest CPU configuration comes up with
every node NotReady and no CNI. The cause is that the CNI's binaries refuse to execute on the CPU
CloudStack exposes to the guest, but nothing in CloudStack surfaces this — the only evidence is in the log
of an init container three levels down.
versions
- ACS: 4.23
- Hypervisor: KVM on Oracle Linux 8 , Ubuntu 24
- Kubernetes: v1.37.0
- CNI: Calico v3.32.2 (
quay.io/calico/cni:v3.32.2,quay.io/calico/node:v3.32.2) - Guest CPU:
guest.cpu.modeunset in/etc/cloudstack/agent/agent.properties(CloudStack default)
The steps to reproduce the bug
- Build a CKS binaries ISO with Calico as the CNI**
./create-kubernetes-binaries-iso.sh /var/www/html 1.37.0 1.9.1 1.37.0 \
https://raw.githubusercontent.com/projectcalico/calico/v3.32.2/manifests/calico.yaml \
0.45.0 setup-v1.37.0 amd64 3.7.0
- Register it and create a cluster
cmk add kubernetessupportedversion name=cks-1.37.0 semanticversion=1.37.0 \
url=http://<host>/setup-v1.37.0-x86_64.iso zoneid=<zone> mincpunumber=2 minmemory=2048
cmk create kubernetescluster name=cks-test zoneid=<zone> \
kubernetesversionid=<id> serviceofferingid=<so> size=1
- Confirm the guest CPU model is the default
On a KVM host, before deploying:
grep -n "^guest.cpu" /etc/cloudstack/agent/agent.properties # expect: no output
Observed on the cluster nodes:
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
test-cks-control-1a0a9b3c3cb NotReady control-plane 5m38s v1.37.0
test-cks-node-1a0a9b420dc NotReady <none> 5m27s v1.37.0
$ kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-db57f7644-m6kln 0/1 Pending 0 6m49s
kube-system calico-node-s8xs2 0/1 Init:Error 6 6m45s
kube-system calico-node-sqxp9 0/1 Init:Error 6 6m49s
kube-system coredns-559f6c778d-v8l2m 0/1 Pending 0 6m50s
kube-system coredns-559f6c778d-wdr4l 0/1 Pending 0 6m50s
kube-system headlamp-65978d54db-psb98 0/1 Pending 0 6m48s
kube-system kube-apiserver-test-cks-control-... 1/1 Running 0 6m56s
kube-system kube-controller-manager-... 1/1 Running 0 6m56s
kube-system kube-proxy-srbqg 1/1 Running 0 6m45s
kube-system kube-scheduler-... 1/1 Running 0 6m56s
The control plane is healthy; only the CNI fails. Everything Pending is downstream of having no pod
network.
The actual error is in the first init container of calico-node:
$ kubectl -n kube-system logs calico-node-sqxp9 -c upgrade-ipam --previous
This program can only be run on AMD64 processors with v2 microarchitecture support.
That message comes from the Go runtime's startup CPU check, emitted when a binary is compiled with
GOAMD64=v2. Calico v3.32's binaries are built for the x86-64-v2 microarchitecture level, which
requires popcnt, sse3, ssse3, sse4_1, sse4_2, cmpxchg16b and lahf_lm.
CloudStack's KVM agent leaves the guest CPU model unset by default (guest.cpu.mode in
agent.properties, read at LibvirtComputingResource.java:1441-1453), so libvirt gives guests the generic
qemu64 model, which is x86-64-v1 only. The binary starts, checks CPUID, and exits 1.
Workaround
Confirm the cause by fixing the CPU model
On each KVM host:
echo "guest.cpu.mode=host-model" >> /etc/cloudstack/agent/agent.properties
systemctl restart cloudstack-agent
Recreate the cluster (the CPU model is applied at VM start, so existing nodes keep the old one). The nodes
now expose the v2 feature set and Calico starts normally:
What to do about it?
The workaround is guest.cpu.mode=host-model (or host-passthrough) on every KVM host, but CloudStack
gives operators no way to discover that from the symptom. Suggestions, roughly in order of value:
-
Document the requirement for CKS. The CKS documentation should state that KVM hosts need a guest
CPU model exposing x86-64-v2 (i.e.guest.cpu.mode=host-modelorhost-passthrough), because current
CNI images require it. This alone would have saved the whole investigation. -
Surface the guest CPU model in CloudStack.
guest.cpu.modebeing per-hostagent.propertieswith
no global/cluster setting and no UI surface is the core usability problem: an admin cannot see or change
what CPU their guests get without SSH-ing to every host. Exposing it as a host detail (alongside
Host.OS.Kernel.Versionetc., which are already reported) would make mismatched hosts visible. -
CKS Code improvement for the api
https://cloudstack.apache.org/api/apidocs-4.23/apis/createKubernetesCluster.html
extraconfig cannot be used. createKubernetesCluster exposes no extraconfig parameter; CKS
deploys its nodes internally via userVmService.createAdvancedVirtualMachine(...)
(KubernetesClusterResourceModifierActionWorker.java:439) without one; and even if it did, the KVM
agent's addExtraConfigComponent (LibvirtComputingResource.java:3468) only appends raw XML to the
domain via vm.addComp(comp). Since CloudStack already emits a <cpu> element, a second one would be
invalid domain XML rather than an override.
Service offering details do not reach the CPU definition either. HypervisorGuruBase routes service
offering details into the extraConfig map (addServiceOfferingExtraConfiguration, line ~257), not into
the VM details map, so they hit the same additive-XML limitation.
A per-VM detail does override it, but cannot be set at CKS deployment time. The KVM agent honours a
VM detail ahead of the host-wide setting:
// LibvirtComputingResource.java:3310-3314
private CpuModeDef createCpuModeDef(VirtualMachineTO vmTO, int vcpus) {
final CpuModeDef cmd = new CpuModeDef();
String cpuMode = details.get(VmDetailConstants.GUEST_CPU_MODE) != null ? details.get(VmDetailConstants.GUEST_CPU_MODE) : guestCpuMode;
String cpuModel = details.get(VmDetailConstants.GUEST_CPU_MODEL) != null ? details.get(VmDetailConstants.GUEST_CPU_MODEL) : guestCpuModel;
VmDetailConstants.GUEST_CPU_MODE is the string "guest.cpu.mode", and the details map comes from
vm_instance_details (HypervisorGuruBase.java:329). So updateVirtualMachine details[0].guest.cpu.mode=host-model
followed by a stop/start does fix an individual node — but only after the VM exists, i.e. after cluster
creation has already failed. There is no way to supply it up front.
This suggests a small, concrete fix.** CKS already passes VM details through customParameterMap when
creating nodes:
// KubernetesClusterResourceModifierActionWorker.java:408-413
Map<String, String> customParameterMap = new HashMap<String, String>();
customParameterMap.put("rootdisksize", String.valueOf(rootDiskSize));
customParameterMap.put(VmDetailConstants.ROOT_DISK_CONTROLLER, "scsi");
Adding VmDetailConstants.GUEST_CPU_MODE to that map — either unconditionally as a sensible default for
CKS nodes, or as an optional createKubernetesCluster parameter — would let operators deploy working CKS
clusters without touching agent.properties on every KVM host.
- Vorherrschende Sprache
- Java
- Sterne
- 3.1k
- Forks
- 1.4k
- Ø Merge
- 6 T. 8 Std.
- Gemergte PRs (30 T.)
- 20
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus apache/cloudstack
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
apache/cloudstack#14248 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
apache/cloudstack#14244 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
apache/cloudstack#14222 ·
Maintainer antworten meist innerhalb von 1 Tag
-
create-kubernetes-binaries-iso.sh builds the ISO without setting a volume ID on EL8 based os'sOffenbug component:kubernetes
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
apache/cloudstack#14180 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug component:projects component:UI
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
apache/cloudstack#14070 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in apache/cloudstack
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
aoqia194/leaf-loader#19 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
apache/streampark#4521 ·
-
Update license yearOffen0 - Backlog 1 - Ready documentation good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
cbor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
FasterXML/jackson-dataformats-binary#844 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Issue: Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
OpenAPITools/openapi-generator#25107 ·
Maintainer antworten meist innerhalb von 1 Tag