<p>I have an application running in the tomcat path /app1, how should I access this from the ingress path? </p>

<p>When accessing "/", it gives the default tomcat 404 - not found page, and when accessing via /app1 it shows "default backend -404" </p>

<p>What I wanna know is:
Is there anyway to configure the context path without using ngnix's ingress controller? (Just using GKE's default ingress controller)</p>

<p>Here is a sample of my ingress:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: gke-my-ingress-1
  annotations:
    kubernetes.io/ingress.global-static-ip-name: gke-my-static-ip
    networking.gke.io/managed-certificates: gke-my-certificate
spec:
  rules:
  - host: mydomain.web.com
    http:
      paths:
      - path: /
        backend:
          serviceName: my-service
          servicePort: my-port
</code></pre>

<p>Edit: service output</p>

<pre><code>kubectl get svc
my-service   NodePort    &lt;IP_REDACTED&gt;   &lt;none&gt;        8080:30310/TCP   5d16h
</code></pre>

<pre><code>kubectl describe svc my-service
Name:                     my-service
Namespace:                default
Labels:                   &lt;none&gt;
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
                            {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"my-service","namespace":"default"},"spec":{"ports":[{"name"...
Selector:                 app=my-deployment-1
Type:                     NodePort
IP:                       &lt;IP_REDACTED&gt;
Port:                     my-port  8080/TCP
TargetPort:               8080/TCP
NodePort:                 my-port  30310/TCP
Endpoints:                &lt;IP_REDACTED&gt;:8080
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>

<p>and this is my Node Port service yaml:</p>

<pre><code>---
apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  ports:
  - name: my-port
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: my-deployment-1
  type: NodePort
</code></pre>

<p>Unfortunately current implementation of default <strong>GKE Ingress Controller</strong> doesn't support rewrite targets. There is still an open github issue that you can find <a href="https://github.com/kubernetes/ingress-gce/issues/109" rel="nofollow noreferrer">here</a>.</p>

<p>What you're trying to achieve is rewriting your ingress path to some specific path exposed by your application, in your case <strong>Apache Tomcat web server</strong>.</p>

<p>Isn't there any possibility to reconfigure your app to be served from the main path by <strong>Apache Tomcat</strong> ? If so, you can make it available on <code>&lt;IngressLoadBalancerIP&gt;/app1</code> by configuring the following path in your <strong>ingress resource</strong> like in the example below:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
spec:
  rules:
  - http:
      paths:
      - path: /*
        backend:
          serviceName: default-backend
          servicePort: 8080
      - path: /app1
        backend:
          serviceName: my-service
          servicePort: 8080
</code></pre>

<p>But unfortunately you cannot configure rewrite in the way that when you go to <code>&lt;IngressLoadBalancerIP&gt;/app1</code> it rewrites to your <code>&lt;my-service&gt;/app1</code>.</p>

<p>It seems that for now the only solution is to install different ingress controller such as mentioned <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">nginx insgress controller</a>.</p>
