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

docs(k8s): a note about k8s credentials #7394

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

afdesk
Copy link
Contributor

@afdesk afdesk commented Aug 26, 2024

Description

This PR adds a block with permissions that Trivy k8s needs for scans:

изображение

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@afdesk afdesk marked this pull request as ready for review September 3, 2024 11:56
@afdesk afdesk requested a review from itaysk September 3, 2024 11:56
Trivy must be able to access information about all cluster resources, including pods, deployments etc.
To successfully scan a Kubernetes cluster, `trivy kubernetes` subcommand must be executed under a role that has some specific permissions.

Without `node collecor` (with flag `--disable-node-collector`) the role must have `list` verb for all resources ("*") inside next API groups: core (""), "apps", "batch","networking.k8s.io", "rbac.authorization.k8s.io":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call-outs box is a bit long. I think we can add a new section for required roles.

CleanShot 2024-09-04 at 09 56 47

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@afdesk afdesk requested a review from knqyf263 September 4, 2024 07:53
@itaysk
Copy link
Contributor

itaysk commented Sep 4, 2024

what happens if I have a resource that trivy doesn't have access to? does it fail or the resource isn't scanned? I hope it the latter in which case I would rewrite this section to say that the user is responsible to give trivy permissions to everything it wants to be scanned. having said that there are things like RBAC which we've seen can break the scan so we need to be sure.

@afdesk
Copy link
Contributor Author

afdesk commented Sep 4, 2024

what happens if I have a resource that trivy doesn't have access to? does it fail or the resource isn't scanned? I hope it the latter in which case I would rewrite this section to say that the user is responsible to give trivy permissions to everything it wants to be scanned. having said that there are things like RBAC which we've seen can break the scan so we need to be sure.

yes, you're right.
there are some resource, that will be skipped without access, but there are required permissions.
I'll add more details and descriptions about credentials and behaviors.

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

Successfully merging this pull request may close these issues.

3 participants