Agent Disk Size Increase
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.
Please advise If we have any update or work around, facing similar issue.
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
kubectl uncordon <nodename>
that should to the trick.
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
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.
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)
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.
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 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.
@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
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?
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.
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
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!