Enabling AuditLog
A brief overview of how you can enable AuditLog.
less than a minute
Enabling AuditLog
This guide describes the steps to enable the AuditLog in a Kubernetes cluster.
Steps to Enable the AuditLog
-
Create the Directory: Navigate to the
$KUBEOPSROOT/limadirectory and create theauditLogfolder:mkdir -p $KUBEOPSROOT/lima/auditLog -
Create the Audit Policy File: In the
$KUBEOPSROOT/lima/auditLogdirectory, create thepolicy.yamlfile:touch $KUBEOPSROOT/lima/auditLog/policy.yaml -
Configure the Audit Policy: Add the content to
policy.yamlaccording to the official Kubernetes Audit Policy documentation. Rules can be added or removed as needed to customize the auditlogs.Example content for
policy.yaml:apiVersion: audit.k8s.io/v1 kind: Policy rules: - level: Metadata resources: - group: "" resources: ["pods"] -
Enable the AuditLog: To enable the auditlog for a cluster, execute the following command:
lima change auditlog <clustername> -a trueExample:
lima change auditlog democluster -a true
Note
-
The auditlog can also be disabled if needed by setting the
-aparameter tofalse:lima change auditlog <clustername> -a false
Additional Information
- More details on configuring the audit policy can be found in the official Kubernetes documentation: Audit Policy.