<p>Say we have a couple of clusters on Amazon EKS. We have a new user or new machine that needs .kube/config to be populated with the latest cluster info.</p>

<p>Is there some easy way we get the context info from our clusters on EKS and put the info in the .kube/config file? something like:</p>

<pre><code>eksctl init "cluster-1-ARN" "cluster-2-ARN"
</code></pre>

<p>so after some web-sleuthing, I heard about:</p>

<pre><code>aws eks update-kubeconfig
</code></pre>

<p>I tried that, and I get this:</p>

<blockquote>
  <p>$ aws eks update-kubeconfig usage: aws [options] 
   [ ...] [parameters] To see help text, you can
  run:</p>
  
  <p>aws help   aws  help   aws   help</p>
  
  <p>aws: error: argument --name is required</p>
</blockquote>

<p>I would think it would just update for all clusters then, but it don't. So I put the cluster names/ARNs, like so:</p>

<pre><code>aws eks update-kubeconfig --name arn:aws:eks:us-west-2:913xxx371:cluster/eks-cluster-1
aws eks update-kubeconfig --name arn:aws:eks:us-west-2:913xxx371:cluster/ignitecluster
</code></pre>

<p>but then I get:</p>

<pre><code>kbc stderr: An error occurred (ResourceNotFoundException) when calling the DescribeCluster operation: No cluster found for name: arn:aws:eks:us-west-2:913xxx371:cluster/eks-cluster-1.
kbc stderr: An error occurred (ResourceNotFoundException) when calling the DescribeCluster operation: No cluster found for name: arn:aws:eks:us-west-2:913xxx371:cluster/ignitecluster.
</code></pre>

<p>hmmm this is kinda dumb 😒 those cluster names exist..so what 🤷 do I do now</p>

Alexander Mills
<p>So yeah those clusters I named don't actually exist. I discovered that via:</p>

<pre><code> aws eks list-clusters
</code></pre>

<p>ultimately however, I still feel strong because we people need to make a tool that can just update your config with all the clusters that exist instead of having you name them.</p>

<p>So to do this programmatically, it would be:</p>

<pre><code>aws eks list-clusters | jq '.clusters[]' | while read c; do
  aws eks update-kubeconfig --name "$c"
done;
</code></pre>
