报错内容如下
Unable to connect to the server: getting credentials: exec plugin is configured to use API version client.authentication.k8s.io/v1beta1, plugin returned version client.authentication.k8s.io/v1alpha1
E0314 18:59:27.499748 1690 memcache.go:238] couldn't get current server API group list: Get "https://AAAAAAAAAAAAAAAAAAAAAAAAAAA.yl4.ap-east-1.eks.amazonaws.com/api?timeout=32s": getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/client/auth/exec/exec.go:62"
E0314 18:59:27.991572 1690 memcache.go:238] couldn't get current server API group list: Get "https://AAAAAAAAAAAAAAAAAAAAAAAAAAA.yl4.ap-east-1.eks.amazonaws.com/api?timeout=32s": getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/client/auth/exec/exec.go:62"
E0314 18:59:28.399304 1690 memcache.go:238] couldn't get current server API group list: Get "https://AAAAAAAAAAAAAAAAAAAAAAAAAAA.yl4.ap-east-1.eks.amazonaws.com/api?timeout=32s": getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/client/auth/exec/exec.go:62"
E0314 18:59:28.807665 1690 memcache.go:238] couldn't get current server API group list: Get "https://AAAAAAAAAAAAAAAAAAAAAAAAAAA.yl4.ap-east-1.eks.amazonaws.com/api?timeout=32s": getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/client/auth/exec/exec.go:62"
E0314 18:59:29.204910 1690 memcache.go:238] couldn't get current server API group list: Get "https://AAAAAAAAAAAAAAAAAAAAAAAAAAA.yl4.ap-east-1.eks.amazonaws.com/api?timeout=32s": getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/client/auth/exec/exec.go:62"
Unable to connect to the server: getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/client/auth/exec/exec.go:62"
1、先配置日志查询我们的eks所属用户
2、查询日志
执行以下查询语句
| sort @timestamp desc
| filter @logStream like /authenticator/
| filter @message like "username=kubernetes-admin"
| limit 50
3、查询当前主机aws configure
[root@ip-172-93-1-106 ~]# aws configure --profile produser
AWS Access Key ID [None]: XXXXXXXXXXXXXX
AWS Secret Access Key [None]: DDDDDDDDDDDDDDDDDDDDDDDDDDDD
Default region name [None]: ap-east-1
Default output format [None]: json
[root@ip-172-93-1-106 ~]# aws s3 ls --profile produser
[root@ip-172-93-1-106 ~]# aws sts get-caller-identity --profile produser
{
"Account": "XXXXXXXXX",
"UserId": "DDDDDDDDDDDDDD",
"Arn": "arn:aws:iam::1111111111:user/abc"
}
[root@ip-172-93-1-106 ~]# aws eks update-kubeconfig --name test --region ap-east-1 --profile produser
Updated context arn:aws:eks:ap-east-1:1111111111:cluster/test in /root/.kube/config
4、执行操作远程k8s
报错如下文章来源:https://www.toymoban.com/news/detail-529208.html
[root@ip-172-93-1-106 ~]# kubectl get nodes
error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"
5、降低kubectl版本
各版本下载地址
https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html文章来源地址https://www.toymoban.com/news/detail-529208.html
curl -O https://s3.us-west-2.amazonaws.com/amazon-eks/1.23.16/2023-01-30/bin/linux/amd64/kubectl
chmod +x kubectl
[root@ip-172-93-1-106 ~]# kubectl get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system aws-node-dh767 1/1 Running 25 (32m ago) 131m
kube-system aws-node-jbgls 1/1 Running 25 (32m ago) 131m
kube-system coredns-68db9f7574-md7c9 1/1 Running 0 149m
kube-system coredns-68db9f7574-vpdk5 1/1 Running 0 149m
kube-system kube-proxy-4lbrz 1/1 Running 0 131m
kube-system kube-proxy-k9tng 1/1 Running 0 131m
到了这里,关于EKS 解决Unable to connect to the server 问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!