尝试 helm ls 时 configmaps is forbidden 错误
configmaps is forbidden error when attempting helm ls
Error: configmaps is forbidden: User "system:serviceaccount:k8s-tiller:k8s-tiller" cannot list configmaps in the namespace "k8s-tiller": clusterrole.rbac.authorization.k8s.io "tiller" not found
有人可以解释这个错误吗? "k8s-tiller": clusterrole.rbac.authorization.k8s.io "tiller" not found
对我来说没有意义。这是什么意思?
请忽略实际如何解决错误,我只是在寻找它的解释。
此错误用于 RBAC(要了解有关 RBAC 的更多信息,请参阅 here)。
命名空间 k8s-tiller
中的 Serviceaccount k8s-tiller
没有在命名空间 k8s-tiller
中列出 configmaps
的权限。另外 Clusterrole tiller
在您的集群中不存在。您为服务帐户 k8s-tiller
创建的 ClusterRoleBinding 或 RoleBinding 包括 ClusterRole tiller
作为 roleRef
。但是那个 ClusterRole tiller
不存在。
我可以确认 nightfury 说的是什么,但你不需要设置 K8S Clusterrole,你只需要为你的命名空间部署一个 tiller 并给它正确的 Role/Rolebinding 和服务帐户
对于部署和历史使用,您可能更愿意为每个 K8S 命名空间部署一个分柄
不覆盖例如一些具有相同名称的部署
所以要这样做:
创建 SA:
kubectl create sa tiller-deploy-sa
创建角色:
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: <Your_namespace>
name: tiller-deploy-role
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
请注意,此角色不推荐用于 PROD,仅用于示例目的
kubectl apply -f <filename>.yml
创建角色绑定:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: tiller-deploy-rolebinding
namespace: <Your_namespace>
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: tiller-deploy-role
namespace: <Your_namespace>
subjects:
- kind: ServiceAccount
name: tiller-deploy-sa
namespace: <Your_namespace>
应用创建的文件
kubectl apply -f <filename>.yml
您可以使用 K8S 文档阅读更多内容:
https://kubernetes.io/docs/reference/access-authn-authz/rbac/
Error: configmaps is forbidden: User "system:serviceaccount:k8s-tiller:k8s-tiller" cannot list configmaps in the namespace "k8s-tiller": clusterrole.rbac.authorization.k8s.io "tiller" not found
有人可以解释这个错误吗? "k8s-tiller": clusterrole.rbac.authorization.k8s.io "tiller" not found
对我来说没有意义。这是什么意思?
请忽略实际如何解决错误,我只是在寻找它的解释。
此错误用于 RBAC(要了解有关 RBAC 的更多信息,请参阅 here)。
命名空间k8s-tiller
中的 Serviceaccount k8s-tiller
没有在命名空间 k8s-tiller
中列出 configmaps
的权限。另外 Clusterrole tiller
在您的集群中不存在。您为服务帐户 k8s-tiller
创建的 ClusterRoleBinding 或 RoleBinding 包括 ClusterRole tiller
作为 roleRef
。但是那个 ClusterRole tiller
不存在。
我可以确认 nightfury 说的是什么,但你不需要设置 K8S Clusterrole,你只需要为你的命名空间部署一个 tiller 并给它正确的 Role/Rolebinding 和服务帐户
对于部署和历史使用,您可能更愿意为每个 K8S 命名空间部署一个分柄 不覆盖例如一些具有相同名称的部署
所以要这样做:
创建 SA:
kubectl create sa tiller-deploy-sa
创建角色:
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: <Your_namespace>
name: tiller-deploy-role
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
请注意,此角色不推荐用于 PROD,仅用于示例目的
kubectl apply -f <filename>.yml
创建角色绑定:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: tiller-deploy-rolebinding
namespace: <Your_namespace>
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: tiller-deploy-role
namespace: <Your_namespace>
subjects:
- kind: ServiceAccount
name: tiller-deploy-sa
namespace: <Your_namespace>
应用创建的文件
kubectl apply -f <filename>.yml
您可以使用 K8S 文档阅读更多内容: https://kubernetes.io/docs/reference/access-authn-authz/rbac/