kiranchavala opened a new issue, #14489:
URL: https://github.com/apache/cloudstack/issues/14489
### problem
NPE observed when a externally managed kubernetes cluster is destoryed
### versions
ACS 4.22.x, 4.23
### The steps to reproduce the bug
1. cmk create kubernetescluster name="test1" description="test1"
zoneid=${ZONE_ID} networkid=${NETWORK_ID} clustertype=ExternalManaged
Note down the cks id
2. Deploy 2 vm is the same network
cmk deploy virtualmachine networkids= zoneid= serviceofferingid= templateid=
3. Add the vms to the cks cluster created
cmk add virtualmachinestokubernetescluster id=${CKS_ID}
virtualmachineids=${VM_ID} iscontrolnode=true
cmk add virtualmachinestokubernetescluster id=${CKS_ID}
virtualmachineids=${VM_ID}
4. Destory the vms
destroy virtualmachine id=${VM_ID1} expunge=true
destroy virtualmachine id=${VM_ID1} expunge=true
5. Delete the cks cluster > NPE observed
delete kubernetescluster id= expunge=true
```
2026-10-22 10:16:56,711 INFO [o.a.c.f.j.i.AsyncJobMonitor]
(API-Job-Executor-95:[ctx-7f3da308, job-346]) (logid:1064cab8) Add job-346 into
job monitoring
2026-10-22 10:16:56,713 DEBUG [c.c.a.ApiServlet]
(qtp1151704483-212023:[ctx-7501e9cd, ctx-c81a67c1]) (logid:531c5ae8) ===END===
10.0.3.251 -- POST
command=deleteKubernetesCluster
response=json
id=f97e9c7c-ffbb-407d-bbbc-280979925730
cleanup=true
expunge=true
sessionkey=s-GpdzR-qtu_71mZxAoNT1Rlkx0
2026-10-22 10:16:56,713 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl$5]
(API-Job-Executor-95:[ctx-7f3da308, job-346]) (logid:b81d92c2) Executing
AsyncJob
{"accountId":2,"cmd":"org.apache.cloudstack.api.command.user.kubernetes.cluster.DeleteKubernetesClusterCmd","cmdInfo":"wiMgiL3pKu\/pPhKb\/UZQdtQFSgtF26vZz7RxpmV6GifbifbNsPlGgFYzrWF2rvldCsfecha4VNhNO1wpAVWURkNuzFdbMaJ+4OmYQHHUS5iMX8oNG5DCjKTOYIvKXNY1cTUxWqZQZUesMXQckhzSibpEVEKg6gVDCOiMjuoXc2wuYYgj\/Qtgr2TrivLSf0\/HsDP9XU+VN1jpCZMuM\/GFuSrt0D1esiaRzGpUthcRVHuFGxFHWqODH8b91uecdxmqal8q0qZaBX1nn6dhFM3+OOzRAPf1RBRXhjcWoJTP8PSZjPk36RS5r7BcRKppvwpUXo\/fnMo7KwMtkvYVrX2+FyZBohFUqX48RG4Nv2tcT\/2UKSUss1f01w3AKSRvA7KplG1IxpvSaS+PdbqFrEugS7KLq+5a1x5VcYmzlkeRWrn8pdAaAr07+\/HwGeSvEoC6tz83ueO1eBE+JSIpeS+C1hXUwcO4QnTGkBR30kkFX\/oFN2vd7ytVRpXmr+db3eAWMN41hP4+A7RA9qoX7s+miTIqycQTyFXdjNikggWPyiz7rnvjLQ8A2UaL7yt8Xh6rMF+F3F++euZ3GB0nRtRrPCflZUnhclmv","cmdVersion":0,"completeMsid":null,"created":null,"id":346,"initMsid":32989224371247,"instanceId":6,"instance
Type":"KubernetesCluster","lastPolled":null,"lastUpdated":null,"processStatus":0,"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":2,"uuid":"b81d92c2-e7ca-4cb8-8622-fca3dc183797"}
2026-10-22 10:16:56,743 ERROR [c.c.a.ApiAsyncJobDispatcher]
(API-Job-Executor-95:[ctx-7f3da308, job-346]) (logid:b81d92c2) Unexpected
exception while executing
org.apache.cloudstack.api.command.user.kubernetes.cluster.DeleteKubernetesClusterCmd
java.lang.NullPointerException: Cannot invoke
"com.cloud.vm.VMInstanceVO.getBackupOfferingId()" because "vm" is null
at
com.cloud.kubernetes.cluster.KubernetesClusterManagerImpl.checkIfVmsAssociatedWithBackupOffering(KubernetesClusterManagerImpl.java:2156)
at
com.cloud.kubernetes.cluster.KubernetesClusterManagerImpl.deleteKubernetesCluster(KubernetesClusterManagerImpl.java:2128)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
```
<img width="1143" height="329" alt="Image"
src="https://github.com/user-attachments/assets/afd92645-4e02-4a4d-981e-819d7d84d532"
/>
### What to do about it?
No NPE should be thrown when a external managed kubernetes cluster is
destoryed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]