Reputation: 487
I have installed Ingress and linked my service to it (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/
where /api/tasks/tasks
shows the service is up while /api/tasks/tasks_count
gives the total number. However in my k8s cluster, I cannot redirect to the different paths within the service. What could be the problem?
Upvotes: 0
Views: 11566
Reputation: 9740
Since this is a result in Google for wildcards and prefixes, I'll answer this old question.
The functionality you're looking for comes from specifying the path type as 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:
prefix path shouldn't contain wildcards
Upvotes: 3