hundreds-evening-84071
06/13/2025, 1:46 PMkubectl auth can-i get pods --all-namespaces --as my-service-account
What am I missing?
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-service-account
namespace: default # You can specify any namespace you prefer
---
apiVersion: <http://rbac.authorization.k8s.io/v1|rbac.authorization.k8s.io/v1>
kind: ClusterRole
metadata:
name: get-pods-clusterrole
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
---
apiVersion: <http://rbac.authorization.k8s.io/v1|rbac.authorization.k8s.io/v1>
kind: ClusterRoleBinding
metadata:
name: get-pods-clusterrolebinding
subjects:
- kind: ServiceAccount
name: my-service-account
namespace: default # Use the same namespace where the service account was created
roleRef:
kind: ClusterRole
name: get-pods-clusterrole
apiGroup: <http://rbac.authorization.k8s.io|rbac.authorization.k8s.io>
bland-article-62755
06/13/2025, 4:16 PMbland-article-62755
06/13/2025, 4:17 PMapiVersion: <http://rbac.authorization.k8s.io/v1|rbac.authorization.k8s.io/v1>
kind: ClusterRole
metadata:
name: get-pods-clusterrole
rules:
- apiGroups: [""]
doesn't match your last line: apiGroup: <http://rbac.authorization.k8s.io|rbac.authorization.k8s.io>
bland-article-62755
06/13/2025, 4:18 PMapiVersion
there but the apiGroups
is null.hundreds-evening-84071
06/13/2025, 4:25 PM