<p>I have deployed Nginx in minikube in AWS EC2 Instance using the below commands:</p>
<pre><code>kubectl create deployment --image=nginx nginx-app
kubectl expose deployment nginx-app --port=80 --name=nginx-http --type=NodePort
</code></pre>
<p>It is available on NodePort: 31568<br />
I have added this port in Security Group and able to access it on browser in another laptop with <code>http://EC2-PublicIP:31568</code></p>
<p>I have many microservices which are to be exposed to outside.</p>
<p>Is there any way to deploy an API Gateway (Nginx or Ingress) and expose on a port and should be able to access other microservices like</p>
<pre><code>http://EC2-PublicIp:31568/helloworld          
http://EC2-PublicIp:31568/mainpage           
http://EC2-PublicIp:31568/editorspage  
       
etc
</code></pre>
<p>I have tried adding metallb, accordingly, an IP is allocated to ingress (load balancer type). I was able to access all the microservices specified in <code>ingress.yaml</code> only inside the EC2 Instance.</p>
<p>This should be accessible from the outside. If yes, then how to configure it?</p>
<p>Any help is appreciated.</p>

Sri Durga
<p>You should be able to do so since you are using Nginx.<br />
the configuration should like something like:</p>
<h3>Annotation comes to help</h3>
<p>The &quot;trick&quot; is to set <code>annotations</code> to support <code>regexp</code> &amp; <code>rewrite-target</code> with:</p>
<pre class="lang-yaml prettyprint-override"><code>  annotations:
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    #
    # the value can be set to  `/` or `$1` or `$2` and so on
    nginx.ingress.kubernetes.io/rewrite-target: &quot;/$1&quot;
</code></pre>
<p>This is the &quot;important&quot; annotation - the rewrite one</p>
<pre><code># Without a rewrite any request will return 404
nginx.ingress.kubernetes.io/rewrite-target: &quot;/$1&quot;
</code></pre>
<hr />
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    #
    # This is the expected line
    # 
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/rewrite-target: &quot;/$1&quot;
spec:
  rules:
  - host: test.com # &lt;- Set your host
    http:
      paths:
        #
        # List of desired paths
        # 
      - path: /path1
        backend:
          serviceName: nginx-http
          servicePort: 80
      - path: /path2/[A-Z0-9]{3}
        backend:
          serviceName: nginx-http
          servicePort: 80
</code></pre>
