Why do Nodes Deleted from LKE Cluster via kubectl Still Appears in Cloud Manager?
I deleted a node from my LKE cluster using kubectl
, but it still appears in the Cloud Manager. These are the commands I executed:
kubectl drain lke$clusterId-$nodeID --ignore-daemonsets --delete-emptydir-data
kubectl delete node lke$clusterId-$nodeID
Why is this happening? Is kubectl
functioning correctly, or is there an issue with my LKE cluster?
1 Reply
kubectl
is primarily designed for managing Kubernetes resources rather than the underlying infrastructure. When you use kubectl
to delete a node from a node pool, the pool size remains unchanged, so a new node will automatically be created to replace the deleted one. As a result, running kubectl delete node $nodeLabel
will initiate a node recycling process.
From the node labels in your LKE cluster, it looks like you aren't using custom labels. Therefore, when kubectl delete node $nodeLabel
is executed, the node is recycled, but the label remains the same. This behavior can make it seem like nodes aren’t being recycled when, in fact, they are. You can confirm if a node has been recycled by running kubectl get nodes
and checking the node's age.
Keep in mind that there may be a short delay between running the kubectl delete
command and the node actually being recycled. This is similar to how nodes are queued for recycling when managed via the Cloud Manager.
If your goal is to permanently delete a specific node from the node pool and reduce the pool size, you’ll need to use the Linode CLI or API. Here’s how:
Via the CLI:
linode-cli lke node-delete $lkeID $nodeID
Via the API:
curl --request DELETE \ --url https://api.linode.com/v4/lke/clusters/clusterId/nodes/nodeId \ --header 'accept: application/json'
For more information, you can refer to our Delete a node guide.
-- Koffi