<p>I am making an app that will use K8S (EKS) to orchestrate the deployments on Cluster. Currently, I am developing using Minikube so its going as expected, but it uses <code>$HOME/.kube/config</code> file to load configuration. What are the other ways to connect to EKS?</p>

<p>Sample Code that I am using for Proof of Work:</p>

<pre class="lang-py prettyprint-override"><code>from kubernetes import client, config

# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()

v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
    print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

</code></pre>

<p>As per documentation for "load_authentication":</p>

<blockquote>
  <p>This function goes through various authentication methods in user section of kube-config and stops if it finds a valid authentication method. The order of authentication methods is:</p>
  
  <ul>
  <li>auth-provider (gcp, azure, oidc)</li>
  <li>token field (point to a token file)</li>
  <li>exec provided plugin</li>
  <li>username/password</li>
  </ul>
</blockquote>

<p>_load_authentication_ - Read authentication from kube-config user section if exists.
Here is an example how to use <code>client.Configuration()</code> with <a href="https://github.com/kubernetes-client/python/blob/6d4587e18064288d031ed9bbf5ab5b8245460b3c/examples/remote_cluster.py" rel="nofollow noreferrer">barer token to authenticate</a>.</p>

<p>Please take a look also for <a href="https://learn.microsoft.com/en-us/python/azure/python-sdk-azure-authenticate?view=azure-python" rel="nofollow noreferrer">Authenticate with the Azure Management Libraries for Python</a></p>

<p><em>###</em> update <em>###</em></p>

<p>For AWS specific env you can use <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html" rel="nofollow noreferrer">AWS SDK for Python (Boto 3)</a> and <a href="https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html" rel="nofollow noreferrer">Create a kubeconfig for Amazon EKS</a></p>

<p>There is an community example - how to setup credentials for aws into kubeconfig or build the configuration <a href="https://stackoverflow.com/questions/54953190/amazon-eks-generate-update-kubeconfig-via-python-script">using boto3</a></p>

<p>Hope this help.</p>
