当前位置:网站首页>[tke] multiple ingress controllers are used in the cluster

[tke] multiple ingress controllers are used in the cluster

2022-06-24 15:34:00 jokey

background

TKE The service in the cluster is enabled by default based on Tencent cloud load balancer Ingress, Support HTTP、HTTPS, At the same time, it also supports the self establishment of others in the cluster Ingress controller , You can choose different... According to your business needs Ingress type , For example, common Nginx Ingress controller .

Installation mode

Mode one : adopt TKE Product oriented Nginx ingress Component installation , Details refer to :TKE Nginx Ingress

Mode two : adopt TKE Console 【 Application market 】 install Nginx Ingress , Application market installation instructions reference :TKE Application market

Mode three : Use through official website documents helm install Nginx Ingress, Details refer to :Helm install Nginx Ingress

Use configuration

The following will be introduced in TKE Two commonly used in Ingress The use of types and multiple Ingress How controllers work together .

Based on Tencent cloud CLB Of Ingress

TKE The default service is based on Tencent cloud CLB Of Ingress function , Users can directly on the console 【 Services and routing 】 Of 【Ingress】 Expose seven layers of services as needed , It can also be applied Ingress YAML Resources to create configurations , be based on CLB Of Ingress The controller management logic is as follows :

  • When Ingress The resource does not have a description annotation kubernetes.io/ingress.class when ,TKE Ingress Controller Will manage the current Ingress resources .
  • When Ingress Resources are annotated kubernetes.io/ingress.class And the value is qcloud when ,TKE Ingress Controller Will manage the current Ingress resources .

Detailed configuration reference :TKE Ingress Controller Usage method .

Nginx Ingress

Nginx Ingress The controller is started by specifying --ingress-class=<INGRESS_CONTROLLER_NAME>

Parameter to declare what you listen to Ingress Configure class scope , The default is nginx ,Nginx Ingress An example of a controller specifying a class name is as follows :

...
spec:
  template:
     spec:
       containers:
         - name: nginx-ingress-internal-controller
           args:
             - /nginx-ingress-controller
             - '--ingress-class=<INGRESS_CONTROLLER_NAME>'
...

When there is Ingress There are annotations in the resource configuration kubernetes.io/ingress.class: "<INGRESS_CONTROLLER_NAME>" Will be monitored and used by the controller , Its Ingress An example of resource configuration is as follows :

...
metadata:
  name: foo
  annotations:
    kubernetes.io/ingress.class: "<INGRESS_CONTROLLER_NAME>"
...

Multiple Ingress The controller is used together

According to the above use and configuration instructions , Suggest all Ingress Resources are configured with annotations to distinguish between different Ingress Range of action of the controller , When you want to use based on CLB Of Ingress when , Configuration comments kubernetes.io/ingress.class:"qcloud" , When you want to use Nginx ingress Controller configuration annotation kubernetes.io/ingress.class:"<INGRESS_CONTROLLER_NAME>"( Don't talk to people based on CLB Ingress Conflict ) that will do .

原网站

版权声明
本文为[jokey]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/05/20210511134106816D.html