inza
inza

Reputation: 97

K8S Audit changes are not being saved in master after restart

i created K8S cluster (unmanaged) in google cloud. i added the following changes in the master:

--audit-dynamic-configuration --feature-gates=DynamicAuditing=true --runtime-config=auditregistration.k8s.io/v1alpha1=true

as written in : https://kubernetes.io/docs/tasks/debug-application-cluster/audit/

and everything is working as expected. but after restart these settings are not being saved.

anyone encounter this problem?

Upvotes: 0

Views: 259

Answers (1)

omricoco
omricoco

Reputation: 931

Assuming you are using kubeadm, this is how you apply flags to the apiserver (all of these changes should be done on the master node)

  1. Edit the following file: /etc/kubernetes/manifests/kube-apiserver.yaml and add these flags to the list of flags:
--audit-dynamic-configuration
--feature-gates=DynamicAuditing=true
--runtime-config=auditregistration.k8s.io/v1alpha1=true

Note that every change done to the kube-apiserver manifest causes the apiserver to restart.

  1. Once it is up and running execute the following command to verify flags are all set and server is up and running: ps -ef | grep kube-apiserver. The output should contain the flags you applied.

In case of issues, see the kube-apiserver logs placed at /var/log/containers/ and search for files beginning with kube-apiserver.

Upvotes: 1

Related Questions