入口使用通配符,尽管我没有指定



我有以下入口:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
namespace: apps
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/custom-http-errors: '404'
spec:
tls:
- hosts:
- mywebsite.com
secretName: my-secret-tls
rules:
- host: mywebsite.com
- http:
paths:
- path: /api/events
pathType: ImplementationSpecific
backend:
service:
name: my-events-api-svc
port:
number: 80

当我kubectl describe这个入口时,我看到以下

Name:             my-ingress
Namespace:        apps
Address:          52.206.112.10
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
TLS:
my-secret-tls terminates mywebsite.com
Rules:
Host        Path  Backends
----        ----  --------
*           
/api/events   my-events-api-svc:80 (10.244.4.145:4000,10.244.5.118:4000)
Annotations:  kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/custom-http-errors: 404
Events:
Type    Reason  Age                From                      Message
----    ------  ----               ----                      -------
Normal  UPDATE  9s (x7 over 153m)  nginx-ingress-controller  Ingress apps/my-ingress

问题是指定的路径不工作,我得到404。我注意到在上面的输出中,主机下有一个*。我的其他入口配置几乎相同(只是设置了不同的路径),并且在kubectl describe输出中没有*。相反,在我的其他入口,适当的主机- &;mywebsite.com&;

上面的输出也有一些错误(<error: endpoints "default-http-backend" not found>),但我在我的其他入口中也看到了它(确实有效)。

有什么问题吗?

这是你的缩进,请查看官方示例

spec:
rules:
- host: hello-world.info
http:
paths:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
namespace: apps
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/custom-http-errors: '404'
spec:
tls:
- hosts:
- mywebsite.com
secretName: my-secret-tls
rules:
- host: mywebsite.com
http:
paths:
- path: /api/events
pathType: ImplementationSpecific
backend:
service:
name: my-events-api-svc
port:
number: 80

相关内容

  • 没有找到相关文章

最新更新