Skip to content

Commit 4678771

Browse files
Mik Vyatskovzacharysarah
Mik Vyatskov
authored and
zacharysarah
committed
Update Audit Logging documentation for 1.10 (#7679)
Signed-off-by: Mik Vyatskov <vmik@google.com>
1 parent 5abd731 commit 4678771

File tree

1 file changed

+64
-0
lines changed
  • docs/tasks/debug-application-cluster

1 file changed

+64
-0
lines changed

docs/tasks/debug-application-cluster/audit.md

+64
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ audit backend using the following kube-apiserver flags:
144144
The webhook config file uses the kubeconfig format to specify the remote address of
145145
the service and credentials used to connect to it.
146146

147+
<<<<<<< HEAD
147148
### Batching
148149

149150
Both log and webhook backends support batching. Using webhook as an example, here's the list of
@@ -194,6 +195,59 @@ same format as described above to the aggregated apiserver and set up the log in
194195
to pick up audit logs. Different apiservers can have different audit configurations and different
195196
audit policies.
196197

198+
||||||| merged common ancestors
199+
=======
200+
### Batching
201+
202+
Both log and webhook backends support batching. Using webhook as an example, here's the list of
203+
available flags. To get the same flag for log backend, replace `webhook` with `log` in the flag
204+
name. By default, batching is enabled in `webhook` and disabled in `log`. Similarly, by default
205+
throttling is enabled in `webhook` and disabled in `log`.
206+
207+
- `--audit-webhook-mode` defines the buffering strategy. One of the following:
208+
- `batch` - buffer events and asynchronously process them in batches. This is the default.
209+
- `blocking` - block API server responses on processing each individual event.
210+
211+
The following flags are used only in the `batch` mode.
212+
213+
- `--audit-webhook-batch-buffer-size` defines the number of events to buffer before batching.
214+
If the rate of incoming events overflows the buffer, events are dropped.
215+
- `--audit-webhook-batch-max-size` defines the maximum number of events in one batch.
216+
- `--audit-webhook-batch-max-wait` defines the maximum amount of time to wait before unconditionally
217+
batching events in the queue.
218+
- `--audit-webhook-batch-throttle-qps` defines the maximum average number of batches generated
219+
per second.
220+
- `--audit-webhook-batch-throttle-burst` defines the maximum number of batches generated at the same
221+
moment if the allowed QPS was underutilized previously.
222+
223+
#### Parameter tuning
224+
225+
Parameters should be set to accommodate the load on the apiserver.
226+
227+
For example, if kube-apiserver receives 100 requests each second, and each request is audited only
228+
on `StageResponseStarted` and `StageResponseComplete` stages, you should account for ~200 audit
229+
events being generated each second. Assuming that there are up to 100 events in a batch,
230+
you should set throttling level at at least 2 QPS. Assuming that the backend can take up to
231+
5 seconds to write events, you should set the buffer size to hold up to 5 seconds of events, i.e.
232+
10 batches, i.e. 1000 events.
233+
234+
In most cases however, the default parameters should be sufficient and you don't have to worry about
235+
setting them manually. You can look at the following Prometheus metrics exposed by kube-apiserver
236+
and in the logs to monitor the state of the auditing subsystem.
237+
238+
- `apiserver_audit_event_total` metric contains the total number of audit events exported.
239+
- `apiserver_audit_error_total` metric contains the total number of events dropped due to an error
240+
during exporting.
241+
242+
## Multi-cluster setup
243+
244+
If you're extending the Kubernetes API with the [aggregation layer][kube-aggregator], you can also
245+
set up audit logging for the aggregated apiserver. To do this, pass the configuration options in the
246+
same format as described above to the aggregated apiserver and set up the log ingesting pipeline
247+
to pick up audit logs. Different apiservers can have different audit configurations and different
248+
audit policies.
249+
250+
>>>>>>> Update Audit Logging documentation for 1.10 (#7679)
197251
## Log Collector Examples
198252

199253
### Use fluentd to collect and distribute audit events from log file
@@ -345,9 +399,19 @@ plugin which supports full-text search and analytics.
345399

346400
## Legacy Audit
347401

402+
<<<<<<< HEAD
348403
__Note:__ Legacy Audit is deprecated and is disabled by default since 1.8 and
349404
will be removed in 1.12. To fallback to this legacy audit, disable the advanced
350405
auditing feature using the `AdvancedAuditing` feature gate in [kube-apiserver][kube-apiserver]:
406+
||||||| merged common ancestors
407+
__Note:__ Legacy Audit is deprecated and is disabled by default since Kubernetes 1.8.
408+
To fallback to this legacy audit, disable the advanced auditing feature
409+
using the `AdvancedAuditing` feature gate in [kube-apiserver][kube-apiserver]:
410+
=======
411+
__Note:__ Legacy Audit is deprecated and is disabled by default since Kubernetes 1.8. Legacy Audit
412+
will be removed in 1.12. To fallback to this legacy audit, disable the advanced auditing feature
413+
using the `AdvancedAuditing` feature gate in [kube-apiserver][kube-apiserver]:
414+
>>>>>>> Update Audit Logging documentation for 1.10 (#7679)
351415

352416
```
353417
--feature-gates=AdvancedAuditing=false

0 commit comments

Comments
 (0)