后不能列出在集群范围内的节点,我得到Error from server (Forbidden): User "system:anonymous" cannot list nodes at the cluster scope. (get nodes)
kubernetes:从服务器错误(禁止):用户“系统:无名氏”,甚至即使承认集群角色后用户授予权限
我有以下设置用户, - context: cluster: kubernetes user: [email protected] name: [email protected]
集在〜/ .kube /配置文件
和下面加到admin.yaml创建集群作用和集群rolebindings
kind: CluserRouster: kubernetes user: [email protected] name: [email protected] apiVersion: rbac.authorization.k8s.io/v1alpha1 metadata: name: admin-role rules: - apiGroups: ["*"] resources: ["*"] verbs: ["*"]
---
oidckind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1alpha1 metadata: name: admin-binding subjects: - kind: User name: [email protected] roleRef: kind: ClusterRole name: admin-role
当我尝试命令时,我仍然收到错误。 kubectl [email protected] get nodes Error from server (Forbidden): User "system:anonymous" cannot list nodes at the cluster scope. (get nodes)
有人可以请建议如何进行。
但在我的情况下,我正在使用OIDC。所以我想我不需要密码,并且OIDC令牌应该使我能够登录。如果我错了,请纠正我。 – NSP
在这种情况下,您需要从kubectl中删除'username'选项并在kubectl中正确配置您的OIDC凭证。 – Lorenz
我想用户需要使用证书和密钥与apiserver交谈。我将不得不使用用户的电子邮件ID来访问api服务器。 – NSP