後不能列出在集羣範圍內的節點,我得到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