<p>Is there a way in Kubernetes to create a service for an external service that should return multiple IP addresses? Currently I am hacking around this by creating an A record in my public DNS provider (route53) and then in Kubernetes creating a service:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: rabbitmq
  labels:
    app: rabbitmq
spec:
  type: ExternalName
  externalName: rabbitmq.mydomainhere.dev
</code></pre>

<p>Is there a way to create a service natively in Kubernetes that returns a fixed set of IP addresses that are not managed inside of the Kubernetes cluster without creating a public DNS record and using <code>externalName</code>?</p>

Justin
<p>You can create a headless service without selectors and set clusterIP to None, then create an endpoint manually to have all your IPs set in the endpoint. You can take a look at the following example.</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: my-es
spec:
  clusterIP: None

---
kind: Endpoints
apiVersion: v1
metadata:
  name: my-es
subsets:
  - addresses:
      - ip: 172.22.111.250
      - ip: 172.22.149.230
    ports:
      - port: 9200
</code></pre>

<p>nslookup output from one Pod</p>

<pre><code>root@curl-66bdcf564-8m6h7:/ ]$ nslookup my-es
Server:    169.254.25.10
Address 1: 169.254.25.10

Name:      my-es
Address 1: 172.22.111.250 172-22-111-250.my-es.default.svc.cluster.local
Address 2: 172.22.149.230 172-22-149-230.my-es.default.svc.cluster.local
</code></pre>
