"--include-kinds pod --disable-node-collector" fails with the "nodes is forbidden" error. #7094
Replies: 2 comments 5 replies
-
Hi @jeremychoi! could you confirm the issue is still relevant for your case with the latest version? |
Beta Was this translation helpful? Give feedback.
-
@afdesk Many thanks for looking into this. However, the problem still occurs. Please see the following logs. Note I can get the pod info from the namespace via 'kubectl get pod -n results-collector--runtime-int'. I suspect Trivy seems to check the 'cluster' scope first and fail the scan if there's no proper permission at the cluster scope. What's expected should be, IMHO, just skipping the checks and proceed for scanning for the 'namespace' scope resources. Please note as I mentioned earlier in the comment above, v0.49 is working successfully against the same cluster environment. $ trivy --version |
Beta Was this translation helpful? Give feedback.
-
Description
It might be related to #6653, but seems more related to the RBAC configuration in the cluster in my case. That's because, when I run the following command:
I have no issue when I run as kubeadmin, but I get an error when I run as only a limited privileged account(but I'm given to the access to the namespace):
Note that "kubectl get pod -n default" is working as I have access to the namespace. The problem seems to come from the fact I don't have privilege to access the "nodes", but I added "--include-kinds pod" so the command should work.
Just as a side note, with v0.49, the following command ran successfully without any issue.
Desired Behavior
The command with "--include-kinds pod" with "--disable-node-collector" runs successfully without the fatal error from the "nodes".
Actual Behavior
I got an error like:
Reproduction Steps
Target
Kubernetes
Scanner
Misconfiguration
Output Format
Table
Mode
Standalone
Debug Output
Operating System
Linux fedora
Version
Checklist
trivy clean --all
Beta Was this translation helpful? Give feedback.
All reactions