Kubernetes Ingress Controller的Nginx多种实现(翻译)

 

原创 云计算技术栈  https://mp.weixin.qq.com/s/bOuZI6KC92NBC3SOgDFQDg

 

在使用K8S的Ingress的时候需要我们自己来选择一个或者多个要使用的Ingress Controller。最常用的就是基于Nginx的Ingress控制器。但是很多人不清楚基于Nginx的控制器不止一种,而且使用上也是有不一致的。这就有必要在使用和遇到问题查阅文档、资料的时候知道自己用的是哪一个。查找的资料是不是对应的自己使用的Ingress 控制器实现。这就有了本篇翻译,希望可以让大家少走弯路。

 


 

背景

 

常见的两种基于Nginx的Ingress Controller实现:

  1. kubernetes/ingress-nginx

  2. nginxinc/kubernetes-ingress

NOTE:1 为kubernetes社区维护的版本 NOTE:再次强调,在查阅资料的时候一定注意是否是自己使用的Ingress Controller对应的文档

 


判断自己使用的是哪个版本

 

可以通过检查自己的Ingress Controller使用的Docker镜像来区分。nginxinc/kubernetes-ingress Ingress控制器的Docker镜像在 DockerHub上就存在,名字是nginx/nginx-ingress.

 

不同Ingress 控制器的主要差别

 

下面的表格列举了不同版本的Ingress 控制器之间的差别。这里之所以出现了三种是因为基于Nginx商业版的nginx plus也有自己的一些特性。所以也一并列举了。

 

功能/特征 kubernetes/ingress-nginx nginxinc/kubernetes-ingress with NGINX nginxinc/kubernetes-ingress with NGINX Plus
基本信息      

维护者

Kubernetes community NGINX Inc and community NGINX Inc and community
NGINX version Custom NGINX build that includes several third-party modules NGINX official mainline build NGINX Plus
商业支持 N/A N/A Included
Ingress实例的LB相关设置      
Merging Ingress rules with the same host Supported Supported via Mergeable Ingresses Supported via Mergeable Ingresses
HTTP load balancing extensions - Annotations See the supported annotations See the supported annotations See the supported annotations
HTTP load balancing extensions -- ConfigMap See the supported ConfigMap keys See the supported ConfigMap keys See the supported ConfigMap keys
TCP/UDP Supported via a ConfigMap Supported via a ConfigMap with native NGINX configuration Supported via a ConfigMap with native NGINX configuration
Websocket Supported Supported via an annotation Supported via an annotation
TCP SSL Passthrough Supported via a ConfigMap Not supported Not supported
JWT validation Not supported Not supported Supported
Session persistence Supported via a third-party module Not supported Supported
Canary testing (by header, cookie, weight) Supported via annotations Supported via custom resources Supported via custom resources
Configuration templates *1 See the template See the templates See the templates
基于CRD的扩展功能      
HTTP load balancing Not supported See VirtualServer and VirtualServerRoute resources. See VirtualServer and VirtualServerRoute resources.
部署方式      
Command-line arguments *2 See the arguments See the arguments See the arguments
TLS certificate and key for the default server Required as a command-line argument/ auto-generated Required as a command-line argument Required as a command-line argument
Helm chart Supported Supported Supported
运维相关      
Reporting the IP address(es) of the Ingress controller into Ingress resources Supported Supported Supported
Extended Status Supported via a third-party module Not supported Supported
Prometheus Integration Supported Supported Supported
Dynamic reconfiguration of endpoints (no configuration reloading) Supported with a third-party Lua module Not supported Supported

Notes:

*1 -- 不同的Ingress控制器使用的Configuration templates格式是不同的.

*2 -- 由于命令行参数存在差别,所以不同的Ingress控制器的部署配置文件(deployment manifest)也是各不相同的。

 

更换Ingress 控制器

 

需要根据上面章节描述的各个方面来处理差异。选择合适您场景的Ingress 控制器。

 

参考文献

 

https://github.com/nginxinc/kubernetes-ingress/blob/master/docs/nginx-ingress-controllers.md

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章