Issue with Elastic Agent ID reservation in Kubernetes Log Collection
Describe the enhancement:
The ability to store "agent.id" in a separate directory needs to be implemented. This update will enable specifying a unified directory during the launch of Docker/Kubernetes, eliminating the need to reset the "agent.id" value with each restart.
Upon agent startup, it will check the directory. If the file is absent, it will generate a unique "agent.id" and create the file. If the file exists, it will retrieve its value, possibly checking the format for correctness of any changes made when editing the value.
This could potentially involve reading the value from an environment variable (Linux) or registry (Windows) on the host where the container is running. In this case, the value will be copied to the file, but actual changes to environment variables/registry will not occur due to their inaccessibility from within the container.
Describe a specific use case for the enhancement or feature:
When deploying elastic-agents in containers, agent.id is recreated each time. This behavior is entirely normal for Kubernetes, as restarting a pod typically results in resetting all settings. However, it poses a challenge in agent tracking, leading to a separation between new and old agents. This results in the loss of the ability to monitor the host's lifecycle over an extended period. In the event of abnormal behavior in Kubernetes pods, a situation may arise where hundreds of objects are created in the fleet console due to repeated agent restarts with the generation of a unique agent.id each time.
Also, isolating agent.id into a separate file would be convenient during agent reinstallation and would allow preserving the event chain in the event of agent removal followed by reinstallation.
This issue doesn't have a Team:<team> label.
Could the development team provide an opinion on the feasibility of implementing this feature?
Hi! We just realized that we haven't looked into this issue in a while. We're sorry!
We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!