Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no subjectaccessreviews access #271

Open
victor23d opened this issue Feb 19, 2021 · 4 comments
Open

no subjectaccessreviews access #271

victor23d opened this issue Feb 19, 2021 · 4 comments

Comments

@victor23d
Copy link

It works on GKE cluster but doesn't work on AKS cluster.
Error log on AKS cluster:
subjectaccessreviews.authorization.k8s.io is forbidden: User \"system:serviceaccount:custom-metrics:custom-metrics-apiserver\" cannot create resource \"subjectaccessreviews\" in API group \"authorization.k8s.io\" at the cluster scope") has prevented the request from succeeding (get pods.custom.metrics.k8s.io *)
It's caused by lacking subjectaccessreviews access.
I could make a pull request to fix it.

@mikkeloscar
Copy link
Contributor

Could you add some more logs to show where the kube-metrics-adapter is failing with this error? I don't understand when it needs those permissions.

@ymmt2005
Copy link

There should be a system ClusterRole named system:auth-delegator for granting access to SubjectAccessReviews API.
ref. https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/#extension-apiserver-authorizes-the-request

As the current manifest has ClusterRoleBinding for system:auth-delegator already, I don't understand the reason too.
Maybe because AKS clusters don't have system:auth-delegator ClusterRole?

@szuecs
Copy link
Member

szuecs commented Mar 2, 2021

@ymmt2005 interesting, maybe @victor23d can check that. In our custom AWS cluster (non eks) we have the clusterrole system:auth-delegator
I just asked in k8s AKS user chat in slack, maybe I will get an answer

@szuecs
Copy link
Member

szuecs commented Mar 2, 2021

I got the answer:

$ kubectl get clusterrole -o yaml system:auth-delegator
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  annotations:
    rbac.authorization.kubernetes.io/autoupdate: "true"
  creationTimestamp: "2021-02-27T08:43:42Z"
  labels:
    kubernetes.io/bootstrapping: rbac-defaults
rules:
- apiGroups:
  - authentication.k8s.io
  resources:
  - tokenreviews
  verbs:
  - create
- apiGroups:
  - authorization.k8s.io
  resources:
  - subjectaccessreviews
  verbs:
  - create

from a 1.19.7 cluster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants