I have created a EKS cluster and able to run the kubectl
commands from my ec2 instance. I have then downloaded the config
file from ~/.kube/config
location to my local machine. I am not able to run the kubectl
commands and getting authentication error.
What is the right way to access an EKS cluster from local machine.
Try look into users
section in ~/.kube/config, check the user
under the name
of the cluster, make sure your local machine has the same working profile as the EC2 instance.
...
command: aws
env:
- name: AWS_PROFILE
value: <make sure this entry is valid on your local machine>
If this doesn't work, can you briefly describe how you configured kubeconfig on the EC2 instance in your question.