I have the following ingress resource
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubernetes-demo-ing
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: \"false\"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    - host: test.my-docker-kubernetes-demo.com
      http:
        paths:
          - path: /*
            backend:
              serviceName: my-demo-service
              servicePort: 3000My app was not getting accessed here test.my-docker-kubernetes-demo.com i was getting too many redirects error
but when i replaced under path from path: /* to path: /, it worked.
But i am not able to find how it fixed the problem, any help in understanding or explaining this would be great.
You should check NGINX Ingress Controller - Rewrite.
Starting in Version 0.22.0, ingress definitions using the annotation
nginx.ingress.kubernetes.io/rewrite-targetare not backwards compatible with previous versions. In Version 0.22.0 and beyond, any substrings within the request URI that need to be passed to the rewritten path must explicitly be defined in a capture groupCaptured groups are saved in numbered placeholders, chronologically, in the form
$1,$2...$n. These placeholders can be used as parameters in therewrite-targetannotation.
You can check version in a following way:
kubectl exec -it <nginx-ingress-controller-pod-name> -n ingress-nginx -- /nginx-ingress-controller --versionI think your Ingress should look like the following:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubernetes-demo-ing
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - host: test.my-docker-kubernetes-demo.com
      http:
        paths:
          - path: /(.*)
            backend:
              serviceName: my-demo-service
              servicePort: 3000You can find a short explanation for spec.rules[].http.paths[].path in k8s.io/api/extensions/v1beta1.
The meaning of / and /* depends on your ingress implementation, for example there are different ways of selecting a range of paths using the NGINX vs GCE ingress implementations:
path: /foo/.*
path: /*
You can choose the implementation to use by setting the kubernetes.io/ingress.class annotation.
In your case, assuming you're using NGINX, /* isn't interpreted as a glob pattern so only allows connecting literally to /*. Anything else would be sent to the default backend.