EKS 解决Unable to connect to the server 问题

这篇具有很好参考价值的文章主要介绍了EKS 解决Unable to connect to the server 问题。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

报错内容如下

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所属用户
EKS 解决Unable to connect to the server 问题,kubernetes,docker,linux
2、查询日志
执行以下查询语句

| sort @timestamp desc
| filter @logStream like /authenticator/
| filter @message like "username=kubernetes-admin"
| limit 50

EKS 解决Unable to connect to the server 问题,kubernetes,docker,linux
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
报错如下

[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模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包