<p>I have an <code>endpoints</code> that I can see via (for example) :</p>
<pre><code>kubectl get endpoints busybox-service
</code></pre>
<p>This endpoints is &quot;backed&quot; by a <code>service</code>:</p>
<pre><code>kubectl get services busybox-service
</code></pre>
<p>Is there a way for me via the <code>endpoints</code> object, to find the &quot;backing&quot; service, without finding it by name?</p>
<p>What I mean by that, is having just the information from (for example):</p>
<pre><code>kubectl get endpoints busybox-service -o=json
</code></pre>
<p>or anything like that, to be able to tell what the <code>metadata.uid</code> of the <em>service</em> is?</p>
<p>So, if I do : <code>kubectl get endpoints busybox-service -o=json</code>, I would get:</p>
<pre><code>&quot;metadata&quot;: {
        &quot;annotations&quot;: {
            &quot;endpoints.kubernetes.io/last-change-trigger-time&quot;: &quot;2023-03-19T19:40:08Z&quot;
        },
        &quot;creationTimestamp&quot;: &quot;2023-03-19T19:40:08Z&quot;,
        &quot;labels&quot;: {
            &quot;a&quot;: &quot;b&quot;
        },
        &quot;name&quot;: &quot;busybox-service&quot;,
        &quot;namespace&quot;: &quot;default&quot;,
        &quot;resourceVersion&quot;: &quot;277476&quot;,
        &quot;uid&quot;: &quot;8d76841b-ad74-4697-8d47-e7449b2cea24&quot;
    }
</code></pre>
<p>that is, I get the <code>uid</code> of the <code>endpoints</code>: <code>&quot;uid&quot;: &quot;8d76841b-ad74-4697-8d47-e7449b2cea24&quot;</code>. Is there an extended call of some kind to the endpoints that would give me the <code>uid</code> of the service that this endpoints is based on.</p>
<p>Something like this does not exist, but may be there is a certain call that I miss:</p>
<pre><code>&quot;metadata&quot;: {
        &quot;annotations&quot;: {
            &quot;endpoints.kubernetes.io/last-change-trigger-time&quot;: &quot;2023-03-19T19:40:08Z&quot;
        },
        &quot;creationTimestamp&quot;: &quot;2023-03-19T19:40:08Z&quot;,
        &quot;labels&quot;: {
            &quot;a&quot;: &quot;b&quot;
        },
        &quot;name&quot;: &quot;busybox-service&quot;,
        &quot;namespace&quot;: &quot;default&quot;,
        &quot;resourceVersion&quot;: &quot;277476&quot;,
        &quot;uid&quot;: &quot;8d76841b-ad74-4697-8d47-e7449b2cea24&quot;
        &quot;ownerReference&quot;: &quot;&lt;UID_OF_THE_SERVICE&gt;&quot;
    }
</code></pre>
<p>Notice the last field: <code>&quot;ownerReference&quot;: &quot;&lt;UID_OF_THE_SERVICE&gt;&quot;</code> - in reality it does not exist, but may be I miss some kind of a call that would give me this information.</p>
<p>Thank you.</p>

Eugene
<p><strong>Endpointslice</strong> object may suit this kind of requirement as it has the <strong><code>ownerRefernce</code></strong> metadata and also the annotations like <code>kubernetes.io/servie-name</code> and <code>endpointslice.kubernetes.io/managed-by</code> which helps to get the source metadata.</p>
<ol>
<li>`kubernetes.io/servie-name helps to indicate the name of the
service object from which the Endpointslice is created.</li>
<li><code>endpointslice.kubernetes.io/managed-by</code>
which can be used to indicate controller or operator which is
managing the <code>Endpointslice</code> object.</li>
</ol>
<p>You can use kubectl describe command to get the details of <strong>ownerReferences</strong> and <strong>annotations</strong> as shown here</p>
<p><strong>ownerReferences:</strong></p>
<pre><code>$ kubectl get endpointslice &lt;endpointslice-name&gt; -o=jsonpath='{.metadata.ownerReferences}'
</code></pre>
<p><strong>Annotations:</strong></p>
<pre><code> $ kubectl describe enpointslice &lt;endpointslice-name&gt; | grep kubernetes.io/servie-name

 $ kubectl describe enpointslice &lt;endpointslice-name&gt; | grep endpointslice.kubernetes.io/managed-by
</code></pre>
<p>For more detailed information refer to these documents <a href="https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/#management" rel="nofollow noreferrer">Endpointslice</a>, <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/" rel="nofollow noreferrer">Ownerships</a></p>
