我有两个独立的 IngressController,一个是内部的,一个是外部的。我想定义每个 Ingress 使用哪个控制器。
我已经--ingress.class=hapxroxy-ext
为外部控制器和内部控制器定义了 arg --empty-ingress-class
。
入口服务
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
run: ext-haproxy-ingress
name: ext-haproxy-ingress
namespace: ext-haproxy-controller
spec:
selector:
run: ext-haproxy-ingress
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
annotations:
"service.beta.kubernetes.io/azure-load-balancer-internal": "true"
labels:
run: haproxy-ingress
name: haproxy-ingress
namespace: haproxy-controller
spec:
selector:
run: haproxy-ingress
type: LoadBalancer
我有 IngressClasses。
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: external-lb
spec:
controller: haproxy.org/ingress-controller/hapxroxy-ext
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: internal-lb
annotations:
"ingressclass.kubernetes.io/is-default-class": "true"
spec:
controller: haproxy.org/ingress-controller
我有一个 Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
"kubernetes.io/ingress.class": internal-lb
spec:
ingressClassName: internal-lb
...
尽管将 Ingress 映射到 just internal-lb
, bothinternal-lb
和external-lb
处理请求。
在docs中看起来很简单,但我遗漏了一些东西。