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

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