I use the clusters on different AWS accounts and every time I want to connect via kubectl I have to do aws configure . How to make other credentials transferred to kubectl ? I think that I pass the --kubeconfig, I can pass the credentials, but I can't figure out how to do it
you can manage the different clusters with a single kubeconfig
as well.
all you need change context for each account cluster with single file
kubectl config get-contexts
but if you still looking for other approaches then you can create kubeconfig
for each account.
export KUBECONFIG=~/.kube/aws-account-1
aws eks update-kubeconfig --name my-clust --region us-east-1 --profile account-1
for second account
export KUBECONFIG=~/.kube/aws-account-2
aws eks update-kubeconfig --name my-clust --region us-east-1 --profile account-2
Now if you want to manage the cluster
of account1
, set kubeconfig to account1.
export KUBECONFIG=~/.kube/aws-account-1
kubectl get pods