amazon-web-services - 加载命名空间时出错。未经授权:验证您有权访问 Kubernetes 集群
问题描述
我已经使用命令行 eksctl 创建了一个 EKS 集群,并验证了该应用程序工作正常。
但是注意到一个奇怪的问题,当我尝试在 Web 浏览器中访问集群中的节点时,我看到以下错误
Error loading Namespaces
Unauthorized: Verify you have access to the Kubernetes cluster
我能够看到使用的节点kubectl get nodes
我以管理员用户身份登录。关于如何解决这个问题的任何帮助都会非常棒。谢谢。
解决方案
您需要将 IAM 角色/用户添加到集群的 aws-auth 配置映射
从https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html采取的基本步骤
kubectl edit -n kube-system configmap/aws-auth
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
mapRoles: |
- rolearn: <arn:aws:iam::111122223333:role/eksctl-my-cluster-nodegroup-standard-wo-NodeInstanceRole-1WP3NUE3O6UCF>
username: <system:node:{{EC2PrivateDNSName}}>
groups:
- <system:bootstrappers>
- <system:nodes>
mapUsers: |
- userarn: <arn:aws:iam::111122223333:user/admin>
username: <admin>
groups:
- <system:masters>
- userarn: <arn:aws:iam::111122223333:user/ops-user>
username: <ops-user>
groups:
- <system:masters>
推荐阅读
- tcl - 获取已编译 tcl 的配置标志
- kotlin - Kotlin 编译器:数据绑定错误,找不到方法
- postgresql - Docker Postgres Container 在 macOS 上不断重生
- c# - 某些更新命令无法自动生成数据库返回以下错误意外错误
- php - Codeigniter 网站无法在未找到的实时服务器页面上运行
- sql - 创建一个将计算多列sql vb.net的饼图
- python - 字符串到 Unicode 显示错误:未定义名称“unicode”
- codeigniter-2 - codeigniter 会话获取空白值
- html - 增加图标字体的高度
- sql - PostgreSQl - 有没有办法从一张桌子到另一张桌子做Upsert?