[英]Path wildcard not working in kubernetes ingress
I have installed Ingress and linked my service to it (usign metallb).我已经安装了 Ingress 并将我的服务链接到它(usign metallb)。
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: test-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /api/tasks/*
# pathType: Exact
backend:
serviceName: tasks-service
servicePort: 5004
The thing is this, I set up the default prefix of the paths in the deployment to be事情是这样的,我将部署中路径的默认前缀设置为
/api/tasks/
/api/任务/
where /api/tasks/tasks
shows the service is up while /api/tasks/tasks_count
gives the total number.其中
/api/tasks/tasks
显示服务已启动,而/api/tasks/tasks_count
给出总数。 However in my k8s cluster, I cannot redirect to the different paths within the service.但是在我的 k8s 集群中,我无法重定向到服务中的不同路径。 What could be the problem?
可能是什么问题呢?
Since this is a result in Google for wildcards and prefixes, I'll answer this old question.由于这是 Google 中通配符和前缀的结果,我将回答这个老问题。
The functionality you're looking for comes from specifying the path type as pathType: Prefix
您正在寻找的功能来自将路径类型指定为
pathType: Prefix
paths:
- path: /api/tasks
pathType: Prefix
backend:
serviceName: tasks-service
servicePort: 5004
Importantly, the path doesn't contain a wildcard character.重要的是,路径不包含通配符。 In fact, cloud providers like AWS will throw errors if you're using their custom load balancer provisioners for Ingress resources:
事实上,如果您将他们的自定义负载均衡器配置器用于 Ingress 资源,AWS 等云提供商会抛出错误:
prefix path shouldn't contain wildcards
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.