kOps 1.19 报告错误“未授权";与 AWS 集群交互时 [英] kOps 1.19 reports error "Unauthorized" when interfacing with AWS cluster
问题描述
我正在按照 kOps 教程在 AWS 上设置集群.我可以用
I'm following the kOps tutorial to set up a cluster on AWS. I am able to create a cluster with
kops create cluster
kops update cluster --yes
但是,在验证我的集群是否设置正确时
However, when validating whether my cluster is set up correctly with
kops validate cluster
我遇到了错误:
unexpected error during validation: error listing nodes: Unauthorized
同样的错误发生在许多其他 kOps 操作中.
The same error happens in many other kOps operations.
我检查了我的 kOps/K8s 版本,它是 1.19:
I checked my kOps/K8s version and it is 1.19:
> kops version
Version 1.19.1 (git-8589b4d157a9cb05c54e320c77b0724c4dd094b2)
> kubectl version
Client Version: version.Info{Major:"1", Minor:"20" ...
Server Version: version.Info{Major:"1", Minor:"19" ...
我该如何解决这个问题?
How can I fix this?
推荐答案
从 kOps 1.19 开始,您会突然收到此错误的原因有两个:
As of kOps 1.19 there are two reasons you will suddenly get this error:
- 如果您删除一个集群并重新配置它,您的旧管理员不会从 kubeconfig 中删除,并且 kOps/kubectl 会尝试重新使用它.
- 默认情况下,新证书的 TTL 为 18 小时,因此您需要大约每天重新配置一次.
通过运行 kops export kubecfg --admin
可以解决上述两个问题.
Both issues above are fixed by running kops export kubecfg --admin
.
请注意,不鼓励使用默认的 TLS 凭据.考虑使用 OIDC 提供商之类的方法.
Note that using the default TLS credentials is discouraged. Consider things like using an OIDC provider instead.
这篇关于kOps 1.19 报告错误“未授权";与 AWS 集群交互时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!