问题
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:
- Kubernetes' Horizontal Pod Autoscaler.
- 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