Can kubernetes Ingress Nginx be autoscaled?

血红的双手。 提交于 2021-02-07 08:29:29

问题


When the Ingress Nginx controller reach its full capacity does it auto scale? Is Kubernetes Ingress even scalable?


回答1:


In principle, the NGINX ingress controller is indeed scalable -- it pulls its entire configuration from the Kubernetes API server and is in itself basically stateless.

In practice, this depends very much on how your ingress controller is set up. First of all, the ingress controller will not auto-scale by itself. If you have deployed it using a Deployment controller, you can use horizontal pod autoscaling as described in the documentation. If you have deployed it using a DaemonSet, the ingress controller will automatically scale up and down with your cluster (maybe even automatically, if you're using the cluster autoscaler).

In both scenarios, you're going to need a Service definition (possibly of type NodePort or LoadBalancer, to allow for external traffic) that matches all pods created by the deployment/daemon set to distribute traffic among them.




回答2:


Yes, it is possible to autoscale nginx ingress controller in two ways:

  1. Kubernetes' Horizontal Pod Autoscaler.
  2. Use multiple nginx ingress controllers per https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/multiple-ingress-controllers. In this approach, you would need multiple nginx ingress resources too to load-balance the traffic to the backend pods. https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/complete-example has example/sample ingress resource for nginx.

The "least connection" (least conn) configuration is not related to autoscaling of nginx. It is the load-balancing algorithm used by nginx and can be changed to others (round robin or ip hash) in the nginx configuration file (nginx.conf) using ConfigMaps.



来源:https://stackoverflow.com/questions/48669961/can-kubernetes-ingress-nginx-be-autoscaled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!