Linux Foundation CKS Exam - Topic 1 Question 32 Discussion
Enable audit logs in the cluster, To Do so, enable the log backend, and ensure that1. logs are stored at /var/log/kubernetes-logs.txt.2. Log files are retained for 12 days.3. at maximum, a number of 8 old audit logs files are retained.4. set the maximum size before getting rotated to 200MBEdit and extend the basic policy to log:1. namespaces changes at RequestResponse2. Log the request body of secrets changes in the namespace kube-system.3. Log all other resources in core and extensions at the Request level.4. Log "pods/portforward", "services/proxy" at Metadata level.5. Omit the Stage RequestReceivedAll other requests at the Metadata level
A) Explanation:
Kubernetes auditing provides a security-relevant chronological set of records about a cluster. Kube-apiserver performs auditing. Each request on each stage of its execution generates an event, which is then pre-processed according to a certain policy and written to a backend. The policy determines what's recorded and the backends persist the records.
You might want to configure the audit log as part of compliance with the CIS (Center for Internet Security) Kubernetes Benchmark controls.
The audit log can be enabled by default using the following configuration incluster.yml:
services:
kube-api:
audit_log:
enabled: true
When the audit log is enabled, you should be able to see the default values at/etc/kubernetes/audit-policy.yaml
The log backend writes audit events to a file inJSONlinesformat. You can configure the log audit backend using the followingkube-apiserverflags:
--audit-log-pathspecifies the log file path that log backend uses to write audit events. Not specifying this flag disables log backend.-means standard out
--audit-log-maxagedefined the maximum number of days to retain old audit log files
--audit-log-maxbackupdefines the maximum number of audit log files to retain
--audit-log-maxsizedefines the maximum size in megabytes of the audit log file before it gets rotated
If your cluster's control plane runs the kube-apiserver as a Pod, remember to mount thehostPathto the location of the policy file and log file, so that audit records are persisted. For example:
--audit-policy-file=/etc/kubernetes/audit-policy.yaml \
--audit-log-path=/var/log/audit.log
Lura
7 months agoKip
8 months agoVan
8 months agoSkye
8 months agoWilda
8 months agoWillow
8 months agoNaomi
8 months agoBettina
8 months agoSherrell
8 months agoAlline
9 months agoLuis
9 months agoElenor
9 months agoMerlyn
9 months agoRebecka
1 year agoSabine
1 year agoFrancine
1 year agoHelga
1 year agoIlene
1 year agoDelsie
12 months agoAlba
1 year agoArlen
1 year agoHyman
1 year agoJacqueline
1 year agoPhung
1 year agoMalinda
1 year agoNikita
1 year agoLaticia
1 year agoArlene
1 year agoMica
1 year agoMauricio
1 year agoSteffanie
1 year agoTalia
1 year agoJesus
1 year agoBrett
1 year agoTegan
1 year agoPhillip
1 year agoCandra
1 year agoWillodean
1 year ago