<p>I would like to use multiple rules under the one ingress name.</p>
<pre><code>{
    &quot;kind&quot;: &quot;Ingress&quot;,
    &quot;spec&quot;: {
        &quot;rules&quot;: [
            {
                &quot;host&quot;: &quot;gke-service-xyz.com&quot;,
                &quot;http&quot;: {
                    &quot;paths&quot;: [
                        {
                            &quot;path&quot;: &quot;/&quot;,
                            &quot;backend&quot;: {
                                &quot;serviceName&quot;: &quot;gke-service&quot;,
                                &quot;servicePort&quot;: 8080
                            }
                        }
                    ]
                }
            },
            {
                &quot;host&quot;: &quot;gke-service1-xyz.com&quot;,
                &quot;http&quot;: {
                    &quot;paths&quot;: [
                        {
                            &quot;path&quot;: &quot;/&quot;,
                            &quot;backend&quot;: {
                                &quot;serviceName&quot;: &quot;gke-service1&quot;,
                                &quot;servicePort&quot;: 8081
                            }
                        }
                    ]
                }
            }
        ]
    },
    &quot;apiVersion&quot;: &quot;extensions/v1beta1&quot;,
    &quot;metadata&quot;: {
        &quot;annotations&quot;: {
            &quot;kubernetes.io/ingress.class&quot;: &quot;nginx&quot;,
            &quot;nginx.ingress.kubernetes.io/ssl-redirect&quot;: &quot;false&quot;
        },
        &quot;name&quot;: &quot;javaservice1-ingress&quot;
    },
    &quot;namespace&quot;: &quot;abc-namespace&quot;
}
</code></pre>
<p><strong>YAML CODE</strong></p>
<pre><code>kind: Ingress
spec:
  rules:
  - host: gke-service-xyz.com
    http:
      paths:
      - path: &quot;/&quot;
        backend:
          serviceName: gke-service
          servicePort: 8080
  - host: gke-service1-xyz.com
    http:
      paths:
      - path: &quot;/&quot;
        backend:
          serviceName: gke-service1
          servicePort: 8081
apiVersion: extensions/v1beta1
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: 'false'
  name: javaservice1-ingress
namespace: abc-namespace
</code></pre>
<p>Here the problem is the first ingress host is working fine but while fetching the second ingress host is not working and it is showing like, 503 Service Temporarily Unavailable. I want both the hosts in a working state. Is there any way to achieve the same?</p>
<ul>
<li>ingress name: service-ingress.</li>
</ul>
<ol>
<li>gke-service-xyz.com</li>
<li>gke-service1-xyz.com</li>
</ol>
<p>Above points 1 and 2 are the ingress endpoints both should work but here only 1 is in working.
Both the above YAML codes are not working.</p>

<p>Try this -</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    kubernetes.io/ingress.class: nginx
  name: staging-ingress
spec:
  rules:
  - host: gke-service-xyz.com
    http:
      paths:
      - path: /(.*)
        backend:
          serviceName: gke-service
          servicePort: 8080
      - path: /api/(.*)
        backend: 
          serviceName: gke-service1
          servicePort: 8081
</code></pre>
<hr />
<p>The question you are asking is something like that you want to have only one domain and use it to route to two services, hence you can use something like URL rewrite for this</p>
