How to limit amount of pods with attached managed disks per node How to limit amount of pods with attached managed disks per node kubernetes kubernetes

How to limit amount of pods with attached managed disks per node


KUBE_MAX_PD_VOLS is what you are looking for. By default it's value is 16 for Azure Disks. So you can either use instances which has same limit of attached disks (16) or set it to preferrable value. You can see where it's declared at github

You should set this environment variable in your scheduler declaration. I found my scheduler declaration in /etc/kubernetes/manifests/kube-scheduler.yaml. This is what it looks now:apiVersion: "v1"kind: "Pod"metadata: name: "kube-scheduler"...spec: containers: - name: "kube-scheduler"... env: - name: KUBE_MAX_PD_VOLS value: "8"...

Note spec.containers.env.KUBE_MAX_PD_VOLS setting - it prevents from scheduling more than 8 disks on each node.

This way pods spread among nodes without any issues, pods which cannot fit stays in Pending state until they find enough nodes to fit in.