Failed to update lock: endpoints "nfs-client-provisioner" is forbidden: User "system:serviceaccount:default:nfs-client-provisioner" cannot update resource "endpoints" in API group "" in the namespace "default"解决这个entire的yaml
时间: 2023-07-19 13:42:00 浏览: 51
这个错误是因为 "system:serviceaccount:default:nfs-client-provisioner" 用户在 default 命名空间中没有更新 endpoints 资源的权限。你需要给这个用户授予更新 endpoints 资源的权限。以下是一个示例 YAML 文件的内容:
```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: nfs-client-provisioner-endpoints-updater
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: nfs-client-provisioner-endpoints-updater-binding
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner
namespace: default
roleRef:
kind: Role
name: nfs-client-provisioner-endpoints-updater
apiGroup: rbac.authorization.k8s.io
```
你可以将上面的 YAML 文件保存为一个文件,比如 `nfs-client-provisioner-rbac.yaml`,然后使用 kubectl apply 命令来创建这个 RBAC 规则:
```
kubectl apply -f nfs-client-provisioner-rbac.yaml
```
这样,"system:serviceaccount:default:nfs-client-provisioner" 用户就可以在 default 命名空间中更新 endpoints 资源了。