Enable kube-audit logs for downstream RKE2 clusters
This document (000021171) is provided subject to the disclaimer at the end of this document.
Environment
Situation
Resolution
Here is an example of the change:
machineGlobalConfig: audit-policy-file: >- {"apiVersion":"audit.k8s.io/v1","kind":"Policy","omitStages":["RequestReceived"],"rules":[{"level":"RequestResponse","resources":[{"group":"","resources":["pods"]}]},{"level":"Metadata","resources":[{"group":"","resources":["pods/log","pods/status"]}]},{"level":"None","resources":[{"group":"","resources":["configmaps"],"resourceNames":["controller-leader"]}]},{"level":"None","users":["system:kube-proxy"],"verbs":["watch"],"resources":[{"group":"","resources":["endpoints","services"]}]},{"level":"None","userGroups":["system:authenticated"],"nonResourceURLs":["/api*","/version"]},{"level":"Request","resources":[{"group":"","resources":["configmaps"]}],"namespaces":["kube-system"]},{"level":"Metadata","resources":[{"group":"","resources":["secrets","configmaps"]}]},{"level":"Request","resources":[{"group":""},{"group":"extensions"}]},{"level":"Metadata","omitStages":["RequestReceived"]}]} cni: calico disable-kube-proxy: false etcd-expose-metrics: false profile: nullThis will add the following defaults to the kube-apiserver running on RKE2:
--audit-policy-file=/var/lib/rancher/rke2/etc/config-files/audit-policy-file --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/rke2/server/logs/audit.logThe audit policy is store in /var/lib/rancher/rke2/etc/config-files/audit-policy-file. It is strongly recommended to only modify the file via the Rancher UI so that it is not overwritten next time you make other cluster changes.
The audit logs can be found in /var/lib/rancher/rke2/server/logs/audit.log
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000021171
- Creation Date: 15-Aug-2023
- Modified Date:06-Sep-2023
-
- SUSE Rancher
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com