[BUG] Deallocated nodes are being reported as "Unhealthy"
- Dominant language
- TypeScript
- Stars
- 2.1k
- Forks
- 395
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 13
Description
**Describe the bug**
When node pool `--scale-down-mode` is being set to Deallocate and scale in 1 node after then, it will cause Unhealty report on Azure portal.
**To Reproduce**
```bash
# Basic parameter for set-up
aks=
rG=
location=southeastasia
# Create resource group
az group create -n ${rG} -l ${location}
# Set `--node-os-upgrade-channel` to None in case cannot scale/change nodepool properties later
az aks create -n ${aks} -g ${rG} \
--nodepool-name agentpool \
--node-count 2 \
--node-os-upgrade-channel None \
--no-ssh-key
# Set to Deallocate for reproducing
az aks nodepool update --name agentpool --cluster-name ${aks} -g ${rG} \
--scale-down-mode Deallocate
# Reproducing issue by scaling in one node
az aks nodepool scale --name agentpool --cluster-name ${aks} -g ${rG} \
--node-count 1
# Giving time for AKS to fully processing
sleep 120
# Checking node ready status
# Issue reproduced here
az aks get-credentials -n ${aks} -g ${rG}
kubectl get node
```
```bash
# Try if stop/start fix the issue
# Stop AKS
az aks stop -n ${aks} -g ${rG}
# Start AKS
az aks start -n ${aks} -g ${rG}
# Issue persists
kubectl get node
```
(Health warning popped up like after ~30 mins after restarting the AKS (part 2 of the script), simply wait and check Azure portal in 30 mins. Make sure the page is being fully refreshed by using `Ctrl+F5`.)
**Expected behavior**
The deallocated nodes should be removed from AKS node list.
**Screenshots**



"The node could not be found in running/powered on state."




(Why there are still 5 Pods on supposed-not-started node? I don't know.)

**Environment (please complete the following information):**
- CLI Version: 2.61.0
- Kubernetes version: 1.28.9
- CLI Extension version: N/A
- Browser: Cloud Shell
**Additional context**
In my memory, this issue persists a long time ago, I just start to dig the root cause today.
Contributor guide
Assessment
This issue has not been assessed yet.