<p>I removed two nodes of my Kubernetes cluster manually first calling &quot;kubectl drain &quot; and then &quot;kubectl delete &quot; for each. While the cluster seems to work without a problem the Azure UI shows me exactly two nodes more than I see when I use &quot;kubectl get nodes&quot;. So when I configure Kubernetes to have 9 nodes in the Azure UI only 7 nodes are there if I take a look with kubectl. Scaling up or down does not solve the problem as Azure is always off by two nodes.
How can I solve this problem? Is there a way I can notify Azure that a node has been deleted?</p>

Manuel 
<p>If you want to solve the issue, you need to have a deeper understanding of the k8s cluster.</p>
<p>When you use the command <code>kubectl delete</code> to remove the node from the agent pool, it means the agent pool won't have control over that node. But it does not mean you really delete the machine. So you can find the number of the machine does not change in the Azure portal. This is the truth you find.</p>
<blockquote>
<p>How can I solve this problem? Is there a way I can notify Azure that a
node has been deleted?</p>
</blockquote>
<p>Here are two questions. For the first, you can express it in this way:</p>
<blockquote>
<p>How to restore the node that deleted before to the agent pool?</p>
</blockquote>
<p>It's simple to solve. You only need to restart the <code>kubelet</code> service in that node. For example, you use the VMSS as the agent pool of the AKS and that node instance id is 4. Then you can do it like this:</p>
<pre><code>az vmss run-command invoke --resource-group group_name --name vmss_name --instance-id 4 --command-id RunShellScript --scripts &quot;service kubelet restart&quot;
</code></pre>
<p>For the second one, you can only use the Azure command to let Azure know the update. Here it means you can scale the agent pool, for example, using the Azure CLI command:</p>
<pre><code>az aks nodepool --resource-group group_name --name agentpool_name --cluster-name cluster_name --node-count 2
</code></pre>
