Skip to content

Commit 29efc5d

Browse files
committed
Documentation of field selectors
Signed-off-by: Richard Wall <[email protected]>
1 parent e3d1c98 commit 29efc5d

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

docs/datagatherers/k8s-dynamic.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ resource referenced in the `kind` for that datagatherer.
6464
There is an example `ClusterRole` and `ClusterRoleBinding` which can be found in
6565
[`./deployment/kubernetes/base/00-rbac.yaml`](./deployment/kubernetes/base/00-rbac.yaml).
6666

67-
# Secrets
67+
## Secrets
6868

6969
Secrets can be gathered using the following config:
7070

@@ -79,4 +79,30 @@ Secrets can be gathered using the following config:
7979

8080
Before Secrets are sent to the Preflight backend, they are redacted so no secret data is transmitted. See [`fieldfilter.go`](./../../pkg/datagatherer/k8s/fieldfilter.go) to see the details of which fields are filteres and which ones are redacted.
8181

82-
> **All resource other than Kubernetes Secrets are sent in full, so make sure that you don't store secret information on arbitrary resources.**
82+
> **All resource other than Kubernetes Secrets are sent in full, so make sure that you don't store secret information on arbitrary resources.**
83+
84+
85+
## Field Selectors
86+
87+
You can use [field selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/#list-of-supported-fields)
88+
to include or exclude certain resources.
89+
For example, you can reduce the memory usage of the agent and reduce the load on the Kubernetes
90+
API server by omitting various common [Secret types](https://kubernetes.io/docs/concepts/configuration/secret/#secret-types)
91+
when listing Secrets.
92+
93+
```yaml
94+
- kind: "k8s-dynamic"
95+
name: "k8s/secrets"
96+
config:
97+
resource-type:
98+
version: v1
99+
resource: secrets
100+
field-selectors:
101+
- type!=kubernetes.io/service-account-token
102+
- type!=kubernetes.io/dockercfg
103+
- type!=kubernetes.io/dockerconfigjson
104+
- type!=kubernetes.io/basic-auth
105+
- type!=kubernetes.io/ssh-auth,
106+
- type!=bootstrap.kubernetes.io/token
107+
- type!=helm.sh/release.v1
108+
```

0 commit comments

Comments
 (0)