Say I get an EKS token using:
aws eks get-token --region us-west-2 --cluster-name eks1
the result looks like:
{"status": {"token": "k8s-aws-v1.aHR0.....Ni"}, "kind": "ExecCredential", "apiVersion": "client.authentication.k8s.io/v1alpha1", "spec": {}}
how can I pass the token to other cli commands? something like:
kubectl get svc --token="$token-from-above"
without the token, I keep getting this error:
error: You must be logged in to the server (Unauthorized)
but my AWS creds are present, which is why I can get the token. I assume it's the same token as generated by aws-iam-authenticator token -i eks1
I tried running this:
export AWS_SESSION_TOKEN="$token-from-above"
kubectl get svc
that did not work either, same error.