KubeArmor icon indicating copy to clipboard operation
KubeArmor copied to clipboard

Extract cluster-name from client go APIs

Open seswarrajan opened this issue 2 years ago • 3 comments

Extract cluster-name in kubearmor using client go API

General Information

  • Any k8s environment

To Reproduce

  1. Deploy KubeArmor in any k8s cluster
  2. Now run karmor log --logFilter all in a new terninal.
  3. Observe the logs

In output of karmor logs, the cluterName for each log is set to default

Expected behavior The log/alerts to have a valid cluster-name. For ex: in the attached screenshot, the cluster name is prod-cluster-onboarding. But it is set as default.

Screenshots

image

seswarrajan avatar Aug 25 '22 05:08 seswarrajan

This might a bit tricky and it's related to this issue https://github.com/kubernetes/kubernetes/issues/44954

s1ntaxe770r avatar Aug 25 '22 15:08 s1ntaxe770r

Hi I want to work on this issue. Could you please assign it to me, it would be beneficial for my academics too. Thanks

@Ankurk99 I can work on this

HariVamsiK avatar Sep 08 '22 14:09 HariVamsiK

Feel free to ask for any help here or on our slack

Ankurk99 avatar Sep 08 '22 14:09 Ankurk99

I was able to reproduce the bug. May i know where i can get the necessary files that i can modify to resolve the issue, i checked the whole repository. BTW i reproduced it on docker driver. Default

HariVamsiK avatar Oct 14 '22 11:10 HariVamsiK

This discussion thread on k8s group makes it sufficiently clear that there is no way to get a cluster name using k8s client go APIs.

Our option is to allow the ability to pass the cluster-name as an option during installation and as part of config and the telemetry generator uses the name from there.

This should be applicable in the context of systemd mode of installation as well where cluster name could be used to refer to "instance groups" for example.

The point is, we simply pick the cluster name from the config entry and set it.

Tasks involved:

  • [ ] check if it is possible to set cluster name using configuration. If not, make a provision for it.
  • [ ] Extend kubearmor-client to set this configuration based on argument in command line option.

nyrahul avatar Oct 15 '22 04:10 nyrahul