AKS icon indicating copy to clipboard operation
AKS copied to clipboard

Agent Disk Size Increase

Open moomzni opened this issue 8 years ago • 13 comments

When an AKS cluster is provisioned there are options to scale the number of nodes but not the underlying storage space allocated to the agent nodes. Is there a means of increasing the storage space allocated to agents by cycling in new agents with increased quotas or is the only option to delete the cluster and start over?

If the latter I think it would be useful to consider the storage space flag as a target for new nodes being provisioned rather than a deploy-time parameter which is honoured through the life of the cluster; this would allow the cycling in of new agent nodes with increased/decreased storage space without having to destroy everything and start from scratch.

moomzni avatar Aug 17 '18 13:08 moomzni

Please advise If we have any update or work around, facing similar issue.

vaibhavenjoys avatar Jan 14 '19 02:01 vaibhavenjoys

If i understand the question properly, you want to extend the size of the underlying node OS primary disk size and not mounting disks through PV and PVC. If that's the case there is an easy way to extend the disk size (depending on what the VM_TYPE is you have chosen).

You can do the following steps:

# moving all running pods to other nodes in the cluster
kubectl drain <nodename> --ignore-daemonsets

after that is done, shut down the virtual machine in the Azure Portal. After the machine has been shut down. Go to its disk properties and go to the Disk resource item and its "configuration" properties. There you can resize the disk to what you want (Each VM Type has restrictions on the size and type of storage (HDD, SSD, and size). After the portal has successfully applied the changes, start the VM back up, wait for the node to be in Ready State and type the following command to make the node back back in scheduling rotation.

kubectl uncordon <nodename>

that should to the trick.

SurushS avatar Jan 28 '19 09:01 SurushS

There are a few more steps for this tricky way, user could follow this guide: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/expand-disks

andyzhangx avatar Jan 28 '19 14:01 andyzhangx

Closing this issue as old/stale.

If this issue still comes up, please confirm you are running the latest AKS release. If you are on the latest release and the issue can be re-created outside of your specific cluster please open a new github issue.

If you are only seeing this behavior on clusters with a unique configuration (such as custom DNS/VNet/etc) please open an Azure technical support ticket.

jnoller avatar Apr 04 '19 18:04 jnoller

When attempting to drain a node on an AKS K8s cluster using:

kubectl drain ${node_name} --ignore-daemonsets

I get the following error:

   "The Node \"aks-agentpool-xxxxx-0\" is invalid: []: Forbidden: node updates may only change labels, taints, or capacity (or configSource, if the DynamicKubeletConfig feature gate is enabled)"

Is there something extra that needs to be done on AKS nodes to allow draining?

(Context: This is part of an automation script I'm writing to drain a kubernetes node for maintenance operations without downtime, so the draining is definitely a prerequisite here)

archmangler avatar Sep 22 '19 11:09 archmangler

There are a few more steps for this tricky way, user could follow this guide: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/expand-disks

@andyzhangx how does this affect scaling? For example, if the initial cluster was created with 100GB disk, we then manually expand disk to 200GB but then add another node will that still create a agent with 100GB?

There has got be a better way of changing node settings such as pod count and disk space, the solutions that are always given is "recreate cluster" which is easier said than done when we have thousands of pods running.

We are close to running out of disk space on our cluster and I need to find a way of increasing it.

abelal83 avatar Nov 05 '19 11:11 abelal83

There are a few more steps for this tricky way, user could follow this guide: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/expand-disks

@andyzhangx how does this affect scaling? For example, if the initial cluster was created with 100GB disk, we then manually expand disk to 200GB but then add another node will that still create a agent with 100GB?

There has got be a better way of changing node settings such as pod count and disk space, the solutions that are always given is "recreate cluster" which is easier said than done when we have thousands of pods running.

We are close to running out of disk space on our cluster and I need to find a way of increasing it.

@abelal83 are you running out of os disk or data disk? it's quite different.

andyzhangx avatar Nov 05 '19 12:11 andyzhangx

@andyzhangx I believe it's OS disk space but I'm not a Linux expert (yet!)

$ df -H Filesystem Size Used Avail Use% Mounted on udev 17G 0 17G 0% /dev tmpfs 3.4G 2.9M 3.4G 1% /run /dev/sda1 32G 28G 3.8G 88% / tmpfs 17G 0 17G 0% /dev/shm tmpfs 5.3M 0 5.3M 0% /run/lock tmpfs 17G 0 17G 0% /sys/fs/cgroup /dev/sdb1 68G 55M 64G 1% /mnt tmpfs 3.4G 0 3.4G 0% /run/user/1002

we've been fighting with this node to reduce usage on /dev/sda1, most of the space used is by /var/lib/docker/overlay2 so we've run docker image prune, docker system prune which gave some space back (about 8%) but I'm worried this will keep happening.

we have ovbiously /dev/sdb1 which I'm not sure of, woudl be great if docker could use that instead of sda1.

abelal83 avatar Nov 05 '19 12:11 abelal83

@andyzhangx I believe it's OS disk space but I'm not a Linux expert (yet!)

$ df -H Filesystem Size Used Avail Use% Mounted on udev 17G 0 17G 0% /dev tmpfs 3.4G 2.9M 3.4G 1% /run /dev/sda1 32G 28G 3.8G 88% / tmpfs 17G 0 17G 0% /dev/shm tmpfs 5.3M 0 5.3M 0% /run/lock tmpfs 17G 0 17G 0% /sys/fs/cgroup /dev/sdb1 68G 55M 64G 1% /mnt tmpfs 3.4G 0 3.4G 0% /run/user/1002

we've been fighting with this node to reduce usage on /dev/sda1, most of the space used is by /var/lib/docker/overlay2 so we've run docker image prune, docker system prune which gave some space back (about 8%) but I'm worried this will keep happening.

we have ovbiously /dev/sdb1 which I'm not sure of, woudl be great if docker could use that instead of sda1.

32G os disk is really too small, we cannot expand os disk for an existing cluster. You may create another new agent pool(make sure you first agent pool is vmss) specifying os-disk-size as a bigger space. Back to your case, there are two ways may help:

  • du /var/log/* -sh # clean up /var/log/ files
  • use a daemonset to clean up unused docker images more aggressively
kubectl apply -f https://raw.githubusercontent.com/meltwater/docker-cleanup/master/contrib/k8s-daemonset.yml

andyzhangx avatar Nov 05 '19 12:11 andyzhangx

yeah 32GB is small indeed, tbh the guy who set this up (much like the rest of us at the time) didn't really know what he was doing. Is there any way to expand the disk? Even if it means we manually do it each time a new node is added when scaling?

abelal83 avatar Nov 05 '19 12:11 abelal83

yeah 32GB is small indeed, tbh the guy who set this up (much like the rest of us at the time) didn't really know what he was doing. Is there any way to expand the disk? Even if it means we manually do it each time a new node is added when scaling?

You cannot change os disk size of existing cluster, pls add another agent pool with bigger os disk. The daemonset is automatic, it will clean up unused images every 60s, while if your running docker images are big, it may not help.

andyzhangx avatar Nov 05 '19 12:11 andyzhangx

not an option for us to add another pool as cluster was setup before node pools were available :( will try that daemonset and hopefully it makes a difference.

I've have to be very honest here about AKS, we've been using it for 2 years now and almost everything that is useful is only available if we create a new cluster, I have no idea how MS expect people to keep creating new clusters then migrate so easily only to take advantage of a new feature (node pools). It would be great if they would think about all the customers who are not in a situation to be able to do this. Having node pool options for existing clusters or at least making it available via some upgrade path would be extremely helpful.

We've been using for 2 years with a struggle, I'm half expecting our management to say soon enough to move away from it which will be a shame.

Thank you for the help though @andyzhangx

abelal83 avatar Nov 05 '19 13:11 abelal83

after being in a desperate situation we did this succesfully and recovered over 60% disk space

kubectl cordon aks-agentpool-xxxx-1
kubectl drain aks-agentpool-xxxx-1 --ignore-daemonsets --delete-local-data
ssh xxx@aks-agentpool-xxx-1
sudo docker stop $(sudo docker ps -a -q) && sudo docker rm $(sudo docker ps -a -q) 
sudo docker system prune -a -f
sudo systemctl stop docker
sudo -i
rm -rf /var/lib/docker/overlay2/*
reboot
ssh xxx@aks-agentpool-xxx-1
sudo docker system prune -a -f
#wait for kube-proxy pod to start
sudo docker system prune -a -f
#run again
sudo docker system prune -a -f
kubectl uncordon aks-agentpool-xxx-1

if any pods are failing to start in kube-system namespace issue "kubectl delete pod <pod-name> --force --grace-period=0 -n kube-system"

I think what happened for us is the image layers and dockers own reference went out of sync, so while docker prune cleared some space it wouldn't do it all unless we manually removed from overlay2 folder.

Hope this helps for anyone who needs it!

abelal83 avatar Nov 06 '19 14:11 abelal83