大网数据广告活动
服务器运维问答

Kubernetes - Ingress vs Nginx with Loadbalancer

· 52CE 我爱测

AFAIK an Ingress is just an abstraction layer to a LoadBalancer service targeting Nginx (or others) Are there features only an ingress can provide? Are there any drawbacks of using LoadBalancer + Nginx?

问题原文

原帖链接 · Eduardo · CC BY-SA 4.0

AFAIK an Ingress is just an abstraction layer to a LoadBalancer service targeting Nginx (or others)

Are there features only an ingress can provide? Are there any drawbacks of using LoadBalancer + Nginx?

已采纳解答

原帖链接 · mdaniel · CC BY-SA 4.0

AFAIK an Ingress is just an abstraction layer to a LoadBalancer service targeting Nginx (or others)

That's only partially true; you can use hostNetworking: true and expose the Ingress controller directly off of the Nodes if you wish, skipping the SDN and the need for a Load Balancer (although with the disadvantage of exposing the ports of your Nodes directly to the Internet) -- and roughly the same idea with Service of type: NodePort just with extra port silliness

A lot of folks do use an Ingress controller behind a LoadBalancer in order to segregate the Nodes from the Internet, but its not a requirement

One should also be aware of the ALB Ingress Controller which goes the other way: asking the LB to do the host: and URI routing before it reaches the cluster, and having no(?) nginx component running in the cluster

Are there features only an ingress can provide?

Only? Unlikely. Convenient and cloud-portable? Extremely

I'm not sure if this is what you are asking, but the reason most folks use a single LB and an in-cluster Ingress controller is the massive cost savings of just paying for one LB with almost limitless Ingress resources. Without an Ingress, one would need to use Service of type: LoadBalaner, and then wait while kubernetes provisions a fresh LB for each Service, costing time and money

Are there any drawbacks of using LoadBalancer + Nginx?

Mostly around error and cost management:

  • there will be an extra network hop from the LB to the in-cluster httpd
  • most LBs have their own health checking scheme, and the LB can fail its health check independent from the ingress controller failing its health check, leading to an artificial outage

    this is also true of routing issues, permissions, cloud quotas, all that jazz

  • there are potentially two different security mechanisms: the LB and the ingress controller's, and if they don't line up, that can lead to an outage
  • if one has access logging turned on, it will log twice, once at the LB and once in the ingress
  • one needs to be aware of the fact that there is in-cluster routing going on, else it will be non-obvious why everything is using just one LB

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-05-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。