<p>I have a spring boot application deployed to minikube. The application has a get mapping exposed as -</p>
<pre><code>@GetMapping(&quot;/ping&quot;)
    public String get(){
        return &quot;Hello !!&quot;;
    }
</code></pre>
<p>Created and applied the deployment and the service. Both are fine and the <code>demo-app</code> container is also running in the cluster.</p>
<p><strong>Deployment manifest</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-app-deployment
  labels:
    app: demo-app
spec:
  selector:
    matchLabels:
      app: demo-app
  replicas: 1
  template:
    metadata:
      labels:
        app: demo-app
    spec:
      imagePullSecrets:
      - name: regcred
      containers:
      - name: demo-app
        image: &lt;&lt;image&gt;&gt;
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
</code></pre>
<p><strong>Service manifest</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: demo-app-service
spec:
  selector:
    app: demo-app
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
</code></pre>
<p><strong>As the last step -</strong></p>
<ol>
<li>Created the Ingress object in the minikube cluster using <code>kubectl create -f ingress.yaml</code></li>
<li>And mapped the <code>minikube ip</code> to this ingress host <code>demo.com</code> in Windows hosts file</li>
</ol>
<p><strong>Ingress manifest</strong></p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: demo-app-ingress
spec:
  rules:
    - host: demo.com
      http:
        paths:
          - path: /demo
            backend:
              serviceName: demo-app-service
              servicePort: 8080
</code></pre>
<p><strong>While trying to access the app from browser, via <em><a href="http://demo.com/demo/ping" rel="nofollow noreferrer">http://demo.com/demo/ping</a></em>  it is giving whiteLabel Error Page</strong>
<a href="https://i.stack.imgur.com/r92Kc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r92Kc.png" alt="enter image description here" /></a></p>
<p>Please help.</p>

pinaki
<p>First what is happening: You specified that you wish to reach the service demo-app-service when you access the URI <a href="http://demo.com/demo" rel="nofollow noreferrer">http://demo.com/demo</a> . That part is working fine. The question here is which path is called on the service? I.e. the URI <a href="http://demo.com/demo/ping" rel="nofollow noreferrer">http://demo.com/demo/ping</a> would request the endpoint /demo/ping in your service.
I guess your ping service is locally accessible via the endpoint http://localhost:8080/ping .
If that is the case all you need to do is add an annotation to the ingress to remove the /demo path from the request:</p>
<pre><code>nginx.ingress.kubernetes.io/rewrite-target: /
</code></pre>
<p>See here for reference: <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#rewrite" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#rewrite</a></p>
