<p>As I am new to kubernetes, struggling to get the list of deployments and other details by using the kubernetes client c#.</p>
<p>Like for</p>
<pre><code> $kubectl get services
 $kubectl get nodes
</code></pre>
<p>Any help would be appreciated...</p>

dinesh
<p>To do that, you first need to be authenticated and authorized to your Kubernetes namespace/cluster.</p>
<pre class="lang-cs prettyprint-override"><code>var config = await KubernetesClientConfiguration.BuildConfigFromConfigFileAsync(new FileInfo(&quot;C:\\Path\\To\\Your\\Kubeconfig\\file&quot;));
var k8sClient = new Kubernetes(config);
</code></pre>
<p>Below is how you can get deployment/service</p>
<pre class="lang-cs prettyprint-override"><code>var deployments = await k8sClient.ListNamespacedDeploymentAsync(&quot;insert-your-namespace-here&quot;);
var services = await k8sClient.ListNamespacedServiceAsync(&quot;insert-your-namespace-here&quot;);
</code></pre>
<p>Example for listing out your deployment/service</p>
<pre class="lang-cs prettyprint-override"><code>foreach (var service in services.Items)
    Console.WriteLine(service.Metadata.Name);

foreach (var item in deployments.Items)
    Console.WriteLine(item.Metadata.Name);
</code></pre>
<p>For more details and examples, check out this repo: <a href="https://github.com/kubernetes-client/csharp" rel="nofollow noreferrer">https://github.com/kubernetes-client/csharp</a></p>
