<p>I have a flask application which has multiple routes including the default route '/'. I deployed this app on the kubernetes. And i am using minikube as a standalone cluster. I exposed the deployment as a NodePort service and then used ingress to map the external request to the application running in cluster. My ingress resource looks like this...</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubernetes-test-svc
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: \"false\"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  backend:
    serviceName: defualt-http-backend
    servicePort: 80
  rules:
  - host: kubernetes-test.info
    http:
      paths:
      - path: /*
        backend:
          serviceName: kubernetes-test-svc
          servicePort: 80
</code></pre>

<p>And i also configured my /etc/hosts file to route request to this host. It looks something like this...</p>

<pre><code>192.168.99.100  kubernetes-test.info
</code></pre>

<p>The problem is no matter which endpoint i call the ingress always redirects it to the default route '/'. My flask app looks like this...</p>

<pre><code>@app.route('/')
def index():
    return "Root route"


@app.route('/route1')
def route1():
    return "Route 1"


@app.route('/route2')
def route2():
    params = request.args
    return make_response(jsonify({'Param1': params['one'], 'Param2': params['two']}))
</code></pre>

<p>So if i make request to kubernetes-test.info/route1 it will show me the text "Root Route" instead of "Route 1".</p>

<p>But if i type 192.168.99.100/route1 it show "Route 1". I dont know why this is happening? Why it is working with minikube ip but not working with host I specified. </p>

<p>Service deployment looks like this:-</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: kubernetes-test-svc
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 8080
    protocol: TCP
    name: http
  selector:
    app: kubernetes-test
</code></pre>

<p>Update your ingress</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubernetes-test-svc
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  backend:
    serviceName: defualt-http-backend
    servicePort: 80
  rules:
  - host: kubernetes-test.info
    http:
      paths:
      - path: /
        backend:
          serviceName: kubernetes-test-svc
          servicePort: 80
</code></pre>
