Need some help on Task2 from CKS Exam 3 its not working, could you please throw some light on this one? after modifying kube-apiserver it never comes up after restart.
Hello txmpods,
Try with the below steps. Also, you can check the steps in the attached gif
# Create /etc/kubernetes/prod-audit.yaml as below:
apiVersion: audit.k8s.io/v1
kind: Policy
rules:
- level: Metadata
namespace: ["prod"]
verb: ["delete"]
resources:
- group: ""
resource: ["secrets"]
# Next, make sure to enable logging in api-server:
- --audit-policy-file=/etc/kubernetes/prod-audit.yaml
- --audit-log-path=/var/log/prod-secrets.log
- --audit-log-maxage=30
# Then, add volumes and volume mounts as shown in the below snippets.
volumes:
- name: audit
hostPath:
path: /etc/kubernetes/prod-audit.yaml
type: File
- name: audit-log
hostPath:
path: /var/log/prod-secrets.log
type: FileOrCreate
volumeMounts:
- mountPath: /etc/kubernetes/prod-audit.yaml
name: audit
readOnly: true
- mountPath: /var/log/prod-secrets.log
name: audit-log
readOnly: false
# save the file and make sure that kube-apiserver restarts

Thanks,
KodeKloud Support