I am getting the following error when trying to use the kubectl command:-
error: You must be logged in to the server (the server has asked for the client to provide credentials)
i am using the eks and after successfully doing all the activity, i have created a serviceaccount having the cluster-admin role attached to it. and using the same i am trying to access the api-server.
configuration-file
apiVersion: v1
kind: Config
clusters:
- name: default-cluster
cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJd01URXdNakUwTkRVd01sb1hEVE13TVRBek1URTBORFV3TWxvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTlp4Cm00amNBUFltdXF5NVpvVFNKSjFjUTdtc1NCN2lxai9WWFloTFVNNFZ3bGdjNDJ3WVVURnc2aHWi9oZVh3T3FiVElrWFllUmwKRm9OdHRkZWQ5QUtoU3VxY0didVBycWhsSGFKTWxhOVBXMmZGeC8xVFBlRk5BeEc4OGZhV01YUC9EMXNxb1MxaQpCSXEvM1ZtaU9rVy9GL1huMHNzTXh5bnNOYmZydFlpcDZURUxuZUdIMS9BZXd4c3pIUzNjdFFRQzVHST0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://1A36198654FEEE06915E639FE356F7832.yl4.ap-south-1.eks.amazonaws.com
contexts:
- name: default-context
context:
cluster: default-cluster
namespace: default
user: default-user
current-context: default-context
users:
- name: default-user
user:
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJu
Not sure what is the issue, why it is not working.