Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to unenroll an Elastic Agent from the client side #125

Closed
jamiesmith opened this issue Sep 16, 2020 · 15 comments
Closed

Add a way to unenroll an Elastic Agent from the client side #125

jamiesmith opened this issue Sep 16, 2020 · 15 comments
Labels
Agent Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@jamiesmith
Copy link

Describe the enhancement:

Currently there's no way to unenroll an elastic-agent from the client side

Describe a specific use case for the enhancement or feature:

When running ephemeral instances (containers, for example) each can enroll, but when the container is stopped we end up with stranded offline instances in fleet, which then takes two commands per host on the Fleet screen (unenroll and force unenroll, because they never unenroll), for a total of 6 clicks, plus delays, for each host.

If there were an unenroll subcommand for ./elastic-agent it could be called in the container teardown

image

@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@EricDavisX
Copy link
Contributor

we should be able to mitigate some of this with plans in place already for 'bulk actions' coming soon; wherein you can select all of the stranded agents, and then do the clicks just once a day or once a week (etc) to get rid of cruft in the UI. I like the idea of having more support on the Agent side, I'm not sure if there are technical reasons it wasn't implemented or considered prior - but we can evaluate it and put it to the roadmap, etc. thanks for logging!

@ph
Copy link
Contributor

ph commented Sep 16, 2020

@ruflin Can you look into this, I think its related to the higher discussion concerning how we work with container.

@ruflin
Copy link
Contributor

ruflin commented Sep 17, 2020

I like the idea of having an elastic-agent unenroll command. This could also be useful if a user wants to switch from managed to standalone. @blakerouse WDYT?

@jamiesmith Is there an option in docker to have a special call on teardown? If not, an option could also be that an Agent is started with a flag -ephemeral which means when the agent is stopped, it also unenrolls.

@jamiesmith
Copy link
Author

I am running it with a shell script in the container, so I would just set up an exit trap, which I verified works (except for a force stop).

@jamiesmith
Copy link
Author

Oh, the ephemeral option is good too

@blakerouse
Copy link
Contributor

@ruflin I think elastic-agent unenroll is a good idea. I do wonder if there is a use-case where a user cannot call elastic-agent unenroll based on setting from Fleet.

@ph
Copy link
Contributor

ph commented Sep 17, 2020

@blakerouse @ruflin

Good point, lets say you have laptop It would be weird to allow someone to unenroll.
Could it be something we configure on the Agent Policy like this Policy only allow for ephemeral agent?

@ruflin
Copy link
Contributor

ruflin commented Sep 18, 2020

I'm not sure the permission to unenroll is always tied to ephemeral feature but we could start with that and then iterate if we get other requests. Also not convinced if a single policy only serves ephemeral agents. Why not an additional flag/setting to make it more obvious?

On top of setting it in the policy, it could also be part of capabilities elastic/beats#21096 A user could probably work around it by stopping and agent, change capabilities and restart it. But that is something the system at least would see.

@ph ph assigned blakerouse and unassigned ruflin Oct 26, 2020
@ph
Copy link
Contributor

ph commented Oct 26, 2020

@blakerouse Can you take a look at this? A bit related to the k8s story.

@blakerouse
Copy link
Contributor

Will look into it, think it is related to uninstall. Both could probably be solved at once.

@blakerouse blakerouse removed their assignment Oct 19, 2021
@jsoriano jsoriano added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Oct 29, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@jlind23 jlind23 transferred this issue from elastic/beats Mar 7, 2022
@jlind23
Copy link
Contributor

jlind23 commented Mar 7, 2022

Closing for now as it never was prioritized. Can be reopened later on if needed. cc @nimarezainia

@jlind23 jlind23 closed this as completed Mar 7, 2022
@ulab
Copy link

ulab commented Aug 30, 2024

I am a little flabbergasted, why an uninstall does not include an unenroll. There should at least be both options available.

@nimarezainia
Copy link
Contributor

@ulab we would prefer to rely on our state machine to unenrol the agent from Fleet when the un-installation at the remote host has occurred. When uninstalled, the agent will miss checkins and transition to OFFLINE and INACTIVE and eventually removed. these changes have been implemented i the upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agent Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

No branches or pull requests