weixin_39617318 2020-11-21 23:45
浏览 0

[WIP] Autoscaling - a living development documentation

Goal

Allow easy setup of node autoscaling suitable for jupyterhub k8s clusters.

An intro to autoscaling

If we have many users, we will have many singleuser pods, each guaranteed some resources. The more users, the more pods, the more resources required. We might want to add nodes when we are unable to schedule more pods, or perhaps when were are close to being unable to schedule more pods. There are various tools available related to scaling, here is a summary.

Instance group autoscaler (google) - nah...

Does not require or understand kubernetes, so it does not account for kubernetes concepts like pods and their requested resources. It will instead look at CPU load of the nodes and add more nodes when the CPU usage is too high. Not relevant to us, as we want to guarantee users to have a certain set of resources on the node they are scheduled.

Horizontal pod autoscaler - nah...

Will increase the number of pods doing a certain task if needed based on for example CPU utilization. This is relevant if you need more copies of the same pod. Each user should only have one pod, not multiple pods, so scaling up in this way makes little sense for the singleuser pods.

Kubernetes cluster autoscaler (aka CA) (google) - YES

This is the relevant autoscaler! What do we want to scale? The available nodes. When do we want to scale? When we are about to run out of resources to schedule new users, or even when we predict that will happen. The kubernetes cluster autoscaler will add nodes to a cluster if it has pods that cant fit in the previous nodes. Awesome!

该提问来源于开源项目:jupyterhub/zero-to-jupyterhub-k8s

  • 写回答

12条回答 默认 最新

  • weixin_39617318 2020-11-21 23:45
    关注

    Regarding cluster autocaling (CA) - considered

    • It seems like the google kubernetes cluster autoscaler will not scale down to one pod without additional setup... https://github.com/kubernetes/autoscaler/issues/582#issuecomment-362540339
    • It seems like enabling autoscalers will create a pod labeled with k8s-app=kube-dns-autoscaler and requesting 20millicores. It would be great if this always was scheduled on the same pod as the hub... But this might be hard to control i think, so instead we could try to make the hub colocate near the CA pod.

    TODO - [x] RECONSIDERED: Make sure the CA pod and hub pod is colocated. - [x] RECONSIDERED: Try to colocate the CA pod with the kube-dns pods as well (k8s-app: kube-dns)

    Report 1 There seem to be various pods that is vital. Since they are vital, and hub and proxy also is vital, they should 'pack' to one single node to allow for a cluster scaler to go down to 1 node. I learned this by reading this

    shell
    kubectl describe pod --selector k8s-app=kube-dns-autoscaler --namespace kube-system
    
    评论

报告相同问题?