<p>I develop a .NET API and I want to deploy it in a Kubernetes pod.
I'm using InClusterConfig():</p>
<pre><code>var config = KubernetesClientConfiguration.InClusterConfig();
_client = new Kubernetes(config);
</code></pre>
<p>I follow this issue (<a href="https://stackoverflow.com/questions/63232463/accessing-kubernetes-service-from-c-sharp-docker">Accessing kubernetes service from C# docker</a>) and I understand that InClusterConfig uses the default service account of the namespace where you are deploying the pod.</p>
<p>Is it possible to specify that the configuration is taken from another service account than default?
Are there other methods to retrieve configuration from a Kubernetes pod?</p>

glorfindel
<p>The Pod will use the ServiceAccount specified in the Pod-manifest, if not specified the <code>default</code> ServiceAccount in the namespace will be used.</p>
<p>You can specify the ServiceAccount for a Pod with the <code>serviceAccountName:</code>-field:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  serviceAccountName: my-service-account
  ...
</code></pre>
<p>Also see <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/" rel="nofollow noreferrer">Configure Service Accounts for Pods</a></p>
