Kubernetes pod auto-scaling

10/19/2018

Is there a way to scale the pods based on pod disk I/O pressure/utilization/IO wait, rather than simple plain CPU and RAM usage? OR maybe a combination of disk IO along with RAM and CPU usage.

something like:

metrics:
  - type: Resource
    resource:
      name: disk
      target:
        type: Utilization
        averageUtilization: 60
-- Ijaz Ahmad Khan
kubernetes

1 Answer

10/19/2018

You should be able to do it with custom metrics. So if you have something like Prometheus in your cluster which is one of the most popular Kubernetes monitoring solutions you can use the k8s-prometheus-adapter

There also a walkthrough here.

For that walkthrough, you will have to use Pod type of metric in your HPA.

For Disk I/O not sure if you mean system disk I/O or Pod disk I/O or PV disk I/O, I don't think there's a solution for all of those together. On the node side, you could scrape the I/O node metrics from the nodeexporter. I don't think there's a pod exporter that exports metrics at the pod level.

Also, for metrics that are not Pod type, they will have to be defined as the Object type in your HPA.

-- Rico
Source: StackOverflow