KubeArmor
KubeArmor copied to clipboard
Ability to reduce log level
Feature Request
Short Description
Controller logs:
kubearmor-controller-6f64474f99-nmntd manager 2023-12-29T13:55:13Z INFO Watching for blocked pods {"controller": "pod", "controllerGroup": "", "controllerKind": "Pod", "Pod": {"name":"evicted-pods-cleaner-28397635-lcx6p","namespace":"kube-system"}, "namespace": "kube-system", "name": "evicted-pods-cleaner-28397635-lcx6p", "reconcileID": "edb22dae-9612-4321-bbc7-b0dbb139f597"}
kubearmor-controller-6f64474f99-nmntd manager 2023-12-29T13:55:14Z DEBUG controller-runtime.webhook.webhooks received request {"webhook": "/mutate-pods", "UID": "217f2ba0-3b8b-4e2e-aa08-6bfe15ae27ba", "kind": "/v1, Kind=Pod", "resource": {"group":"","version":"v1","resource":"pods"}}
kubearmor-controller-6f64474f99-nmntd manager 2023-12-29T13:55:14Z DEBUG controller-runtime.webhook.webhooks wrote response {"webhook": "/mutate-pods", "code": 200, "reason": "", "UID": "217f2ba0-3b8b-4e2e-aa08-6bfe15ae27ba", "allowed": true}
kubearmor-controller-6f64474f99-nmntd manager 2023-12-29T13:55:14Z INFO Watching for blocked pods {"controller": "pod", "controllerGroup": "", "controllerKind": "Pod", "Pod": {"name":"evicted-pods-cleaner-28397635-lcx6p","namespace":"kube-system"}, "namespace": "kube-system", "name": "evicted-pods-cleaner-28397635-lcx6p", "reconcileID": "d5e60b63-124a-4d81-9bc0-974fb3fe2227"}
kubearmor-controller-6f64474f99-nmntd manager 2023-12-29T13:55:14Z INFO Watching for blocked pods {"controller": "pod", "controllerGroup": "", "controllerKind": "Pod", "Pod": {"name":"evicted-pods-cleaner-28397630-vkn2n","namespace":"kube-system"}, "namespace": "kube-system", "name": "evicted-pods-cleaner-28397630-vkn2n", "reconcileID": "66621c26-eecc-4f04-9452-d2043aedf44a"}
kubearmor-controller-6f64474f99-nmntd manager 2023-12-29T13:55:14Z INFO Watching for blocked pods {"controller": "pod", "controllerGroup": "", "controllerKind": "Pod", "Pod": {"name":"evicted-pods-cleaner-28397630-vkn2n","namespace":"kube-system"}, "namespace": "kube-system", "name": "evicted-pods-cleaner-28397630-vkn2n", "reconcileID": "0c6f0e23-85be-4285-a8c3-46b6ffbb0d68"}
Other components are most likely also affected.
I'd like to be able to set desired logLevel so for example only errors are being logged.
Describe the solution you'd like
Add a flag.
@michalschott Where would this flag be added?
Either as a runtime flag or could use env var
The operator also generates tons of repetitive logs
This logs is constant: {"level":"info","ts":1724084554.4051137,"caller":"controller/cluster.go:579","msg":"Config CR Status Updated Successfully"}
This is how many of those were generated in 3 days of the operator being deployed:
$ kubectl -n kubearmor logs kubearmor-operator-68b77d66ff-sgdmt | grep "Config CR Status Updated Successfully" | wc -l
24549
The controller is supposed to have the --zap-log-level
flag:
https://github.com/kubearmor/KubeArmor/blob/63534cad71635f574aee84275c814175e183f23a/pkg/KubeArmorController/main.go#L55
https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/log/zap#Options.BindFlags
For the operator and the snitch, I'm providing the PR below: