[英]K8s: Multiple nginx-ingress-controller ingress rules in GKE
I have a catch all ingress rule for a domain *.foo.com
, and then I have one specific rule for a domain a.foo.com
. 我有一个域名
*.foo.com
全部进入规则,然后我有一个域名a.foo.com
特定规则。 According to the documentation, the ingress rule for a.foo.com
must take priority over the one with a wildcard (because it's a better match than the wildcard). 根据文档,
a.foo.com
的入口规则必须优先于带有通配符的规则(因为匹配比通配符更好)。 However, this isn't happening. 但是,这没有发生。 How do I set priorities explicitly?
如何明确设置优先级? What am I doing wrong?
我究竟做错了什么?
Here's my generic ingress rule: 这是我的通用入口规则:
$ kubectl describe ing foo
Name: foo
Namespace: foo
Address: x.x.x.x
Default backend: default-http-backend:80 (x.x.x.x:8080)
TLS:
foo.com terminates *.foo.com
Rules:
Host Path Backends
---- ---- --------
*.foo.com
/ foo:8888 (<none>)
Here's the domain specific rule: 这是特定于域的规则:
$ kubectl describe ing foo-a
Name: foo-a
Namespace: foo
Address: x.x.x.x
Default backend: default-http-backend:80 (x.x.x.x:8080)
TLS:
foo.com terminates a.foo.com
Rules:
Host Path Backends
---- ---- --------
a.foo.com
/hello foo-a:8080 (<none>)
You will need to configure each of your nginx-ingress controllers to have a different ingress-class
name. 您将需要将每个nginx-ingress控制器配置为具有不同的
ingress-class
名称。 Then in your ingress definition, you should specify the kubernetes.io/ingress.class: "my-ingress"
to point to the ingress controller you want to use for that particular ingress. 然后,在入口定义中,应指定
kubernetes.io/ingress.class: "my-ingress"
以指向要用于该特定入口的入口控制器。
Setup details are included in the [nginx-ingress docs].( https://kubernetes.github.io/ingress-nginx/user-guide/multiple-ingress/ ) 设置详细信息包含在[nginx-ingress文档]中。( https://kubernetes.github.io/ingress-nginx/user-guide/multiple-ingress/ )
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.