You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/target/kubernetes.md
+35-1
Original file line number
Diff line number
Diff line change
@@ -49,10 +49,41 @@ You can also specify a `kubeconfig` using the `--kubeconfig` flag:
49
49
trivy k8s --kubeconfig ~/.kube/config2
50
50
```
51
51
52
-
By default, all cluster resource images will be downloaded and scanned.
52
+
## Required roles
53
+
To successfully scan a Kubernetes cluster, `trivy kubernetes` subcommand must be executed under a role or a cluster role that has some specific permissions.
54
+
55
+
The role must have `list` verb for all resources (`"*"`) inside the following API groups: core (`""`), `"apps"`, `"batch"`,`"networking.k8s.io"`, `"rbac.authorization.k8s.io"`:
If `node collector` is enabled (default: enabled), Trivy needs a cluster role with some additional permissions to run and track the jobs:
65
+
```yaml
66
+
- apiGroups: [""]
67
+
resources: ["nodes/proxy", "pods/log"]
68
+
verbs: ["get"]
69
+
- apiGroups: [""]
70
+
resources: ["events"]
71
+
verbs: ["watch"]
72
+
- apiGroups: ["batch"]
73
+
resources: ["jobs", "cronjobs"]
74
+
verbs: ["list", "get"]
75
+
- apiGroups: ["batch"]
76
+
resources: ["jobs"]
77
+
verbs: ["create","delete", "watch"]
78
+
- apiGroups: [""]
79
+
resources: ["namespaces"]
80
+
verbs: ["create"]
81
+
```
53
82
54
83
### Skip-images
55
84
85
+
By default, all cluster resource images will be downloaded and scanned.
86
+
56
87
You can control whether Trivy will scan and download the cluster resource images. To disable this feature, add the --skip-images flag.
57
88
58
89
- `--skip-images` flag will prevent the downloading and scanning of images (including vulnerabilities and secrets) in the cluster resources.
@@ -91,6 +122,9 @@ You can control which namespaces will be discovered using the `--include-namespa
91
122
92
123
By default, all namespaces will be included in cluster scanning.
93
124
125
+
!!! note "using `--exclude-namespaces`"
126
+
Trivy requires a complete list of namespaces to exclude specific ones. Therefore, `--exclude-namespaces` option is only available for cluster roles now.
0 commit comments