简体   繁体   English

GKE RBAC角色/角色绑定到集群中的访问节点状态

[英]GKE RBAC role / rolebinding to access node status in the cluster

I can't get a rolebinding right in order to get node status from an app which runs in a pod on GKE. 我无法获得正确的角色绑定,才能从在GKE上的Pod中运行的应用程序获取节点状态。

I am able to create a pod from there but not get node status. 我能够从那里创建一个Pod,但无法获取节点状态。 He is the role I am creating: 他是我正在创建的角色:

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: node-reader
rules:
- apiGroups: [""] # "" indicates the core API group
  resources: ["nodes"]
  verbs: ["get", "watch", "list"]

This is the error I get when I do a getNodeStatus: 这是我执行getNodeStatus时遇到的错误:

{
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Failure",
    "message": "nodes \"gke-cluster-1-default-pool-36c26e1e-2lkn\" is forbidden: User \"system:serviceaccount:default:sa-poc\" cannot get nodes/status at the cluster scope: Unknown user \"system:serviceaccount:default:sa-poc\"",
    "reason": "Forbidden",
    "details": {
        "name": "gke-cluster-1-default-pool-36c26e1e-2lkn",
        "kind": "nodes"
    },
    "code": 403
}

I tried with some minor variations but did not succeed. 我尝试了一些细微的变化,但没有成功。

Kubernetes version on GKE is 1.8.4-gke.1 GKE上的Kubernetes版本是1.8.4-gke.1

Any help appreciated, thanks! 任何帮助表示赞赏,谢谢!

<resource>/<subresource>权限表示为<resource>/<subresource> ,因此在该角色中,您将指定resources: ["nodes","nodes/status"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在现有 GKE 集群上启用 RBAC - Enabling RBAC on Existing GKE Cluster AKS RBAC - 角色绑定无效 - AKS RBAC - Rolebinding has no effect Kubernetes 1.6+ RBAC:通过kubectl以角色cluster-admin的身份访问 - Kubernetes 1.6+ RBAC: Gain access as role cluster-admin via kubectl 如何将相同的 RBAC 角色分配给两个不同的 IAM 角色以访问 EKS 中的集群? - How can I assign the same RBAC role to two different IAM roles to access a cluster in EKS? GKE 集群上的网络文件共享访问 - Windows 节点池 - Network File share access on GKE cluster - Windows node pool GKE Kubernetes RBAC将默认角色绑定到我的有限定制 - GKE Kubernetes RBAC bind default role to my limited custom 在实施RBAC时,即使在应用roleBinding之后,默认用户仍保留访问权限 - Implementing RBAC, the default user still retains access even after applying roleBinding 如何在使用Terraform启动GKE集群时引导RBAC权限 - How to bootstrap RBAC privileges when bringing up a GKE cluster with Terraform 如何在GKE kubernetes集群中调试ABAC到RBAC转换? - How to debug ABAC to RBAC transition in a GKE kubernetes cluster? Kubernetes RBAC“由 RoleBinding 允许”但“无法列出资源” - Kubernetes RBAC "Allowed by RoleBinding" but "cannot list resource"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM