Kubernetes 空间访问受限的Spinnaker

Kubernetes 空间访问受限的Spinnaker,kubernetes,spinnaker,spinnaker-halyard,Kubernetes,Spinnaker,Spinnaker Halyard,我试图用kubernetes设置spinnaker,但得到一个错误:用户无法列出名称空间 我无权访问群集范围中的列表命名空间。是否可以在不访问集群范围内的列表名称空间的情况下设置和应用hal配置?如果是,请告诉我步骤 我在下面提到的命令仅供参考: hal deploy apply + Get current deployment Success - Prep deployment Failure Problems in default.provider.kubernetes.my-k8s

我试图用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

问候,, Ajaz

简短回答:不

您可以尝试让管理员授予您访问
ClusterRole
+
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

你可以不用ClusterRole来完成。 经过测试,工作正常

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

使用Halyard hal命令行工具将Halyard配置为在Kubernetes集群中安装Spinnaker

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