【问题标题】:configmaps is forbidden error when attempting helm ls尝试 helm ls 时 configmaps 被禁止错误
【发布时间】:2018-12-05 19:01:41
【问题描述】:
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 对我来说没有意义。这是什么意思?

请忽略如何实际解决错误,我只是在寻找它的解释。

【问题讨论】:

    标签: kubernetes kubernetes-helm


    【解决方案1】:

    RBAC 出现此错误(要了解有关 RBAC 的更多信息,请参阅 here)。

    Serviceaccount 命名空间k8s-tiller 中的k8s-tiller 无权列出命名空间k8s-tiller 中的configmapsClusterrole tiller 也不存在于您的集群中。您为服务帐户 k8s-tiller 创建的 ClusterRoleBinding 或 RoleBinding 包含 ClusterRole tillerroleRef。但是那个 ClusterRole tiller 不存在。

    【讨论】:

      【解决方案2】:

      我可以确认 nightfury 的意思,但您不需要设置 K8S Clusterrole,您只需为您的命名空间部署一个分蘖并为其提供正确的角色/角色绑定和服务帐户

      对于部署和历史使用,您可能更愿意为每个 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/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-09-08
        • 1970-01-01
        • 2019-04-05
        • 2022-10-14
        • 2020-12-18
        • 1970-01-01
        • 1970-01-01
        • 2020-05-27
        相关资源
        最近更新 更多