<p>I am learning Kubernetes and have deployed a headless service on Kubernetes(on AWS) which is exposed to the external world via nginx ingress.</p>

<p>I want <code>nslookup &lt;ingress_url&gt;</code> to directly return IP address of PODs.
How to achieve that?</p>

Saurav Prakash
<p>If you declare a “headless” service with selectors, then the internal DNS for the service will be configured to return the IP addresses of its pods directly. This is a somewhat unusual configuration and you should also expect an effect on other, cluster internal, users of that service.</p>

<p>This is documented <a href="https://kubernetes.io/docs/concepts/services-networking/service/#with-selectors" rel="nofollow noreferrer">here</a>. Example:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: my-service
spec:
  clusterIP: None
  selector:
    app: MyApp
  ports:
  - name: http
    protocol: TCP
    port: 80
    targetPort: 9376
</code></pre>
