Last active
September 14, 2021 13:52
-
-
Save mauilion/1a4f4ab0de860b86057c971e352e8ea8 to your computer and use it in GitHub Desktop.
kind audit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.outcoldsolutions.com/docs/monitoring-kubernetes/v4/audit/ | |
apiVersion: audit.k8s.io/v1 | |
kind: Policy | |
rules: | |
# Do not log from kube-system accounts | |
- level: None | |
userGroups: | |
- system:serviceaccounts:kube-system | |
- level: None | |
users: | |
- system:apiserver | |
- system:kube-scheduler | |
- system:volume-scheduler | |
- system:kube-controller-manager | |
- system:node | |
# Do not log from collector | |
- level: None | |
users: | |
- system:serviceaccount:collectorforkubernetes:collectorforkubernetes | |
# Don't log nodes communications | |
- level: None | |
userGroups: | |
- system:nodes | |
# Don't log these read-only URLs. | |
- level: None | |
nonResourceURLs: | |
- /healthz* | |
- /version | |
- /swagger* | |
# Log configmap and secret changes in all namespaces at the metadata level. | |
- level: Metadata | |
resources: | |
- resources: ["secrets", "configmaps"] | |
# We want to catch a little more then outcoldsolutions specified ;) | |
- level: RequestResponse | |
omitStages: | |
- RequestReceived |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
featureGates: | |
PodSecurity: true | |
nodes: | |
- role: control-plane | |
extraMounts: | |
- containerPath: /etc/kubernetes/policies/adv-audit.yaml | |
hostPath: ./adv-audit.yaml | |
readOnly: true | |
- role: worker | |
kubeadmConfigPatches: | |
- | | |
apiVersion: kubeadm.k8s.io/v1beta2 | |
kind: ClusterConfiguration | |
metadata: | |
name: config | |
apiServer: | |
extraArgs: | |
audit-policy-file: "/etc/kubernetes/policies/adv-audit.yaml" | |
audit-log-path: "/var/log/kubernetes/kube-apiserver-audit.log" | |
audit-log-format: "json" | |
extraVolumes: | |
- name: "audit-policies" | |
hostPath: "/etc/kubernetes/policies" | |
mountPath: "/etc/kubernetes/policies" | |
readOnly: true | |
pathType: DirectoryOrCreate | |
- name: "audit-logs" | |
hostPath: "/var/log/kubernetes" | |
mountPath: "/var/log/kubernetes" | |
readOnly: false | |
pathType: DirectoryOrCreate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment