Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paths in Kubernetes Ingress Specs

I have the following ingress resource for one of my apps

apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name:""
    annotations:
      ingress.kubernetes.io..
  spec:
    rules:
    - host: my-app
      http:
        paths:
        - path: /path/to/service
          backend:
            serviceName: my-service
            servicePort: 80

This works as expected and I can access my service at http://my-app/path/to/service. However the service in my app takes query parameters that dont seem to correctly get redirected for eg:

http://my-app/path/to/service/more/paths

This brings me back to http://my-app/path/to/service

How can I maintain this path structure ?

like image 906
user_mda Avatar asked Oct 05 '18 13:10

user_mda


1 Answers

I believe you need to use wildcards on your path:

apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name:""
    annotations:
      ingress.kubernetes.io..
  spec:
    rules:
    - host: my-app
      http:
        paths:
        - path: /path/to/service/*
          backend:
            serviceName: my-service
            servicePort: 80

More information here. Seems like it's hard to find any docs with wildcard examples. Not that this is specific to nginx, it may not work with other ingress controllers.

like image 140
Rico Avatar answered Oct 17 '22 15:10

Rico