<p>I have created an <code>Elasticsearch</code> resource using the below yaml manifest after installing the eck-operator as mentioned <a href="https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-elasticsearch.html" rel="nofollow noreferrer">here</a>.</p>
<pre><code>apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  version: 7.15.0
  nodeSets:
  - name: default
    count: 1
    config:
      node.store.allow_mmap: false
</code></pre>
<p>After this manifest is applied, I can get the status manually by executing:</p>
<pre><code>kubectl get elasticsearch -n ecknamespace
</code></pre>
<p>and the output would be as follows:</p>
<pre><code>&gt; $ kubectl get elasticsearch -n ecknamespace
  NAME          HEALTH   NODES  VERSION   PHASE   AGE 
  quickstart    green    3       7.15.0   Ready   3d17h
</code></pre>
<p>Using the <a href="https://github.com/kubernetes-client/csharp" rel="nofollow noreferrer">Kubernetes C# Client</a>, how do I get the above data programmatically?</p>

<p>The client includes an <a href="https://github.com/kubernetes-client/csharp/tree/master/examples/customResource" rel="nofollow noreferrer">example</a> of how to interact with custom resources.</p>
<p>It will require you to define the classes described in the files <code>cResource.cs</code> and <code>CustomResourceDefinition.cs</code>.</p>
<p>Afterwards, the following code should list the <code>elasticsearch</code> resource:</p>
<pre><code>var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
var client = new GenericClient(config,  &quot;elasticsearch.k8s.elastic.co&quot;, &quot;v1&quot;, &quot;elasticsearches&quot;);
var elasticSearches = await client.ListNamespacedAsync&lt;CustomResourceList&lt;CResource&gt;&gt;(&quot;default&quot;).ConfigureAwait(false);
foreach (var es in elasticSearches.Items)
{
    Console.WriteLine(es.Metadata.Name);
}
</code></pre>
<p><strong>EDIT</strong> after OP's comments: to view all fields of the custom resource, one needs to edit the <code>CustomResource</code> class (file <code>CustomResourceDefinition.cs</code> in the example) with the corresponding fields.</p>
