<p>I have an <code>Ingress</code> object set up to route traffic to the appropriate <code>Service</code> based on the <code>Url</code> path. I would like to access/expose this <code>Ingress</code> object within another <code>Pod</code>. I'm wondering if this is possible?</p>
<p>I tried to set up a <code>Service</code> on the <code>Ingress</code> but that didn't seem to work.</p>

<p>So, for whatever reason (ssr, lots of microservices, etc) you want to access k8s resources using their ingress path mapping, instead of calling each service by its internal name.
For example, you have an ingress config like that:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
  rules:
    - host: example.com
      http:
        paths:
          - path: /api/users/?(.*)
            backend:
              serviceName: auth-service
              servicePort: 80
          - path: /api/cart/?(.*)
            backend:
              serviceName: cart-service
              servicePort: 80
</code></pre>
<p>and you want to access <code>auth-service</code> using <code>http://example.com/api/auth</code> instead of <code>http://auth-service</code>.</p>
<p>All you have to do is replace domain part (<code>example.com</code> in our case) with ingress service url. It depends on your configuration and environment, but usually it looks like <code>http://[SERVICE_NAME].[NAMESPACE]</code>, for example:</p>
<ul>
<li>GCP - <code>http://ingress-nginx-controller.ingress-nginx</code></li>
<li>Helm ingress nginx - <code>http://my-release-ingress-nginx-controller</code> (here we are
using only service name part, because helm installs ingress in
default namespace)</li>
<li>Minikube - if you are using minikube ingress
addon, then you might run into problem where you cannot access
ingress, then just use helm version. (dont disable ingress addon - just install helm version alongside of it)</li>
</ul>
<p>Get namespaces: <code>kubectl get namespaces</code>
Get service names inside namespace <code>kubectl get services -n [NAMESPACE]</code>.</p>
