I just wanted to mention the way I ended up achieving this. After generating kubeconfigs for all the clusters, merge them down to a single kubeconfig using the below command,
export KUBECONFIG=$(ls *.kubeconfig|tr '\n' ':')
echo "Merging all kubeconfig to a single file"
kubectl config view --merge --flatten >all_merged.config
Thanks for your solution, I was looking for the same thing. One question, since the endpoint you’re calling seems undocumented, is there any way to pass a token expiration? I’d like to have short lived tokens (max 1h) since I’m using it into a script.