@Vijin Palazhi Can you please help me to identify the root cause for the below f . . .

Deepak Ladwa:
@Vijin Palazhi Can you please help me to identify the root cause for the below failure seen during audit file definition.

root@controlplane:~# kubectl -n kube-system get events -o wide |grep -i audit
4m55s       Warning   FailedMount         pod/kube-apiserver-controlplane                                                       kubelet, controlplane     MountVolume.SetUp failed for volume "ac" : hostPath type check failed: /etc/kubernetes/audit.yaml is not a file                                                                                                                                                                                                                   7m3s         10      kube-apiserver-controlplane.168fda467ae6b323
72s         Warning   FailedMount         pod/kube-apiserver-controlplane                                                       kubelet, controlplane     MountVolume.SetUp failed for volume "ac" : hostPath type check failed: /etc/kubernetes/prod-audit.yaml is not a file                                                                                                                                                                                                              2m15s        8       kube-apiserver-controlplane.168fda8964d289b7
root@controlplane:~# 

Kube API server configuration for the audit policy

    - --audit-policy-file=/etc/kubernetes/prod-audit.yaml
    - --audit-log-path=/var/log/audit.log
    - --audit-log-maxbackup=3
.
.
.
    - mountPath: /etc/kubernetes/prod-audit.yaml
      name: ac
      readOnly: true
    - mountPath: /var/log/audit.log
      name: al
      readOnly: false 

.
.
.
   - hostPath:
      path: /etc/kubernetes/prod-audit.yaml
      type: File
    name: ac
  - hostPath:
      path: /var/log/audit.log
      type: FileOrCreate
    name: al

If I move the audit file under /etc/kubernetes/pki => Its work fine.

unnivkn:
Deepak, may I know which lab is this ?

Deepak Ladwa:
Kk labs only

Deepak Ladwa:
post lab refersh, it worked. not sure what was the issue.