If you were using the nginx ingress, you would do it like this:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /data
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /test/data
        backend:
          serviceName: test
          servicePort: 6006

(See: https://github.com/kubernetes/ingress-nginx/tree/master/docs/examples/rewrite)

But I'm not sure how you'd do it using traefik. (And I don't think the standard k8s ingress controller supports rewrite.)

HTH,

DR

On 04/27/2018 03:11 PM, Kanthi P wrote:
Hi, Need some help with ingress controller
we want to redirect a http request say <host>/<path>/xyz to be mapped to a
service in the backend. And the service should receive the request as
<host>/xyz
How do we annotate this in the ingress resource?

Have configured the ingress resource as shown:


apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: traefik
  name: test-ingress
  namespace: default
spec:
  rules:
  - http:
      paths:
      - backend:
          serviceName: test
          servicePort: 6006
        path: /test
status:
  loadBalancer: {}

But the problem is <host>/test/data gets redirected as <host>/, but we want
it to be redirected as <host>/data
Any idea how to annotate this?


--
You received this message because you are subscribed to the Google Groups "Kubernetes 
user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to