Dario Romero
Dario Romero

Reputation: 29

How to stop (deallocate) kubernetes nodes in azure without deleting the cluster?

I would like to stop and deallocate the nodes in a kubernetes cluster in azure so It cannot be billed during weekends for example. I just can set to a minimun of 1 node using the az CLI

Any idea will be appreciated

Upvotes: 2

Views: 3020

Answers (3)

blessedwithsins
blessedwithsins

Reputation: 1

You can use AKS Start/Stop option or Stop VMSS manually by going to Infrastructure Resource Group, but that isn't supported and shouldn't be used.

https://learn.microsoft.com/en-us/azure/aks/start-stop-cluster?tabs=azure-cli

Also, for any user Nodepool, you can put the count to 0 now.

https://learn.microsoft.com/en-us/azure/aks/scale-cluster

Upvotes: 0

kunal
kunal

Reputation: 476

Usually if we use PowerShell then Automation runbook can work for us. Unfortunately I could not find PowerShell to start/ stop AKS. Azure CLI do support AKS start and stop. Also it maintains the state of AKS cluster so that you can start where you had left. One way is to use Azure CLI and find a way to automate on your own. Refer this link for Azure CLI of start stop automation - https://learn.microsoft.com/en-us/azure/aks/start-stop-cluster?tabs=azure-cli

Other way is to use ready solution. I found this marketplace solution that runs a VM and shuts down/ starts AKS cluster on the time specified. Refer this link for the deployment - https://azuremarketplace.microsoft.com/en-in/marketplace/apps/bowspritconsultingopcprivatelimited1596291408582.aksautomation2?tab=Overview

If you are good with automation and writing scripts then use option 1 else go for option 2.

Upvotes: 0

Miguel Santos
Miguel Santos

Reputation: 11

If your are using scale sets (used for autoscaling and multiple node pools) you can deallocate the scale sets via ui (search in the resource the scale sets are created) or via az cli az-vmss-deallocate

Upvotes: 1

Related Questions