我发现无法连接到eks上的k8s集群。
我遇到错误
error: You must be logged in to the server (Unauthorized)
但是,
我有多个集群:
$ kubectl config get-clusters
NAME
hilarious-unicorn-1568659474.eu-west-1.eksctl.io
arn:aws:eks:eu-west-1:<redacted>:cluster/derp
这些也在我这样做的时候出现
$ kubectl config get-contexts
我的问题是,如果我通过运行kubectl config use-context <my context>
切换到eu-west群集/上下文,
然后kubectl cluster-info
我得到
error: You must be logged in to the server (Unauthorized)
我跑了
$ aws eks update-kubeconfig --name myCluster
这在我的~/.kube/config
文件中进行了更新,但无济于事。
我真不知道为什么它不能工作,因为它以前可以工作,我可以在另一个集群上进行身份验证。
@Eduardo Baitello
aws-iam-authenticator
。尽管我们也使用awsmfa。这是我的.kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: redacted
server: redacted
name: arn:aws:eks:eu-west-1:redacted:cluster/savvy
- cluster:
certificate-authority-data: redacted
server: redacted
name: hilarious-unicorn-1568659474.eu-west-1.eksctl.io
contexts:
- context:
cluster: arn:aws:eks:eu-west-1:redacted:cluster/savvy
user: arn:aws:eks:eu-west-1:redacted:cluster/savvy
name: arn:aws:eks:eu-west-1:redacted:cluster/savvy
- context:
cluster: hilarious-unicorn-1568659474.eu-west-1.eksctl.io
user: karl@hilarious-unicorn-1568659474.eu-west-1.eksctl.io
name: karl@hilarious-unicorn-1568659474.eu-west-1.eksctl.io
current-context: arn:aws:eks:eu-west-1:redacted:cluster/savvy
kind: Config
preferences: {}
users:
- name: arn:aws:eks:eu-west-1:redacted:cluster/savvy
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- --region
- eu-west-1
- eks
- get-token
- --cluster-name
- savvy
command: aws
- name: karl@hilarious-unicorn-1568659474.eu-west-1.eksctl.io
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- token
- -i
- hilarious-unicorn-1568659474
command: aws-iam-authenticator
env: null
跑步kubectl describe configmap -n kube-system aws-auth
表示我(Unauthorized)