【问题标题】:Spinnaker with restricted namspace access具有受限命名空间访问权限的 Spinnaker
【发布时间】:2018-09-20 17:20:04
【问题描述】:

我正在尝试使用 kubernetes 设置 spinnaker,但出现错误:用户无法列出命名空间。

我无权访问集群范围内的列表命名空间。是否可以在不访问集群范围内的列表命名空间的情况下设置和应用 hal 配置?如果是,请告诉我步骤。

下面我提一下命令供参考:

hal deploy apply
+ Get current deployment
  Success
- Prep deployment
  Failure
Problems in default.provider.kubernetes.my-k8s-account:
! ERROR Unable to communicate with your Kubernetes cluster: Failure
  executing: GET at: https://<company>/api/v1/namespaces. Message:
  Forbidden! User apc doesn't have permission. namespaces is forbidden: User
  "system:anonymous" cannot list namespaces at the cluster scope..
? Unable to authenticate with your Kubernetes cluster. Try using
  kubectl to verify your credentials.

- Failed to prep Spinnaker deployment

$ kubectl get ns
No resources found.
Error from server (Forbidden): namespaces is forbidden: User "ds:uid:2319639648" cannot list namespaces at the cluster scope

问候, 阿贾兹

【问题讨论】:

    标签: kubernetes spinnaker spinnaker-halyard


    【解决方案1】:

    简短回答:不。

    您可以尝试让您的管理员授予您对ClusterRole+RoleBinding 的访问权限,该RoleBinding 有权读取命名空间。

    类似这样的:

    kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: namespace-reader
    rules:
    - apiGroups: [""]
      resources: ["namespaces"]
      verbs: ["get", "watch", "list"]
    
    ---
    kind: ClusterRoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: read-all-namespaces
    subjects:
    - kind: User
      name: your-user
      apiGroup: rbac.authorization.k8s.io
    roleRef:
      kind: ClusterRole
      name: namespace-reader
      apiGroup: rbac.authorization.k8s.io
    

    【讨论】:

      【解决方案2】:

      您可以在没有 ClusterRole 的情况下做到这一点。 经过测试,按预期工作。

      instruction

      Configure Spinnaker to install in Kubernetes

      重要提示:默认情况下,这将限制 Spinnaker 部署到指定的命名空间。如果您希望能够部署到其他命名空间,请添加第二个云提供商目标或删除 --namespaces 标志。

      使用 Halyard hal 命令行工具配置 Halyard 以在您的 Kubernetes 集群中安装 Spinnaker

      hal config deploy edit \
        --type distributed \
        --account-name ${ACCOUNT_NAME} \
        --location ${NAMESPACE}
      

      【讨论】:

        猜你喜欢
        • 2012-07-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-12-29
        • 2017-08-26
        • 2021-11-28
        • 1970-01-01
        • 2020-09-29
        相关资源
        最近更新 更多