即使在向用户授予集群角色之后,我也得到了Error from server (Forbidden): User "system:anonymous" cannot list nodes at the cluster scope. (get nodes)
我为用户设置了以下内容:
- context:
cluster: kubernetes
user: user@gmail.com
name: user@kubernetes` set in the ~/.kube/config file
并将以下内容添加到 admin.yaml 以创建集群角色和集群角色绑定:
kind: CluserRouster: kubernetes user: nsp@gmail.com name: nsp@kubernetese
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: nsp@gmail.com
roleRef:
kind: ClusterRole
name: admin-role
当我尝试该命令时,我仍然收到错误。
kubectl --username=user@gmail.com get nodes
Error from server (Forbidden): User "system:anonymous" cannot list nodes at the cluster scope. (get nodes)
有人可以建议如何进行。