<p>I know a scenario of kubernetes headless service <strong>with</strong> selector.
But what’s the usage scenario of kubernetes headless service <strong>without</strong> selector?</p>

Cain
<p>Services without selectors are used if you want to have an external database cluster in production, but in your test environment you use your own databases,  to point your Service to a Service in a different  <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces" rel="nofollow noreferrer">Namespace</a>  or on another cluster, when you are migrating a workload to Kubernetes. 
Service without selectors are often used to alias external services into the cluster DNS.</p>

<p>Here ia an example of service without selector:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: example-service
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376

</code></pre>

<p><strong>This Service has no selector, the corresponding Endpoint object is  <em>not</em>  created automatically. You can manually map the Service to the network address and port where it’s running, by adding an Endpoint object manually:</strong></p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Endpoints
metadata:
  name: example-service
subsets:
  - addresses:
      - ip: 192.0.2.42
    ports:
      - port: 9376
</code></pre>

<p>If you have more that one IP address for redundancy, you can repeat them in the addresses array. Once the endpoints are populated, the load balancer will start redirecting traffic from your Kubernetes service to the IP addresses, </p>

<blockquote>
  <p><strong>Note:</strong>  The endpoint IPs  <em>must not</em>  be: loopback (127.0.0.0/8 for IPv4, ::1/128 for IPv6), or link-local (169.254.0.0/16 and 224.0.0.0/24 for IPv4, fe80::/64 for IPv6). Endpoint IP addresses cannot be the cluster IPs of other Kubernetes Services, because  <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/" rel="nofollow noreferrer">kube-proxy</a>  doesn’t support virtual IPs as a destination.</p>
</blockquote>

<p>You can access a Service without a selector the same as if it had a selector. </p>

<p>Take a look: <a href="https://kubernetes.io/docs/concepts/services-networking/service/#services-without-selectors" rel="nofollow noreferrer">services-without-selector</a>, <a href="https://stackoverflow.com/questions/61822431/what-s-the-usage-scenario-of-kubernetes-headless-service-without-selector#comment109421978_61822628">example-service-without-selector</a>.</p>
